Class: Data

Mobizen.Socket.Channel.Data

new Mobizen.Socket.Channel.Data(socket)

Name Type Description
socket Mobizen.Socket

A provider of Mobizen/Socket API.

Extends

Members

inherited name string

The name of channel of socket.

started boolean

inherited tasks object

Store of the tasks.

Type Definitions

inherited protocol Protocol

A provider of the web protocol API.

A provider of Mobizen/Socket API.

Methods

draw(type, data)

Name Type Description
type string
data object

inherited virtual error(payload, data)

Name Type Description
payload object
data * optional
Name Type Description
action string
data object
Returns:
Type Description
Mobizen.Socket.Channel~Task event emmiter
Returns:
Type Description
Mobizen.Socket.Channel~Task event emmiter

open(channel)

Name Type Description
channel string

The name of channel of socket.

Name Type Description
type string
data object
Fires:
Returns:
Type Description
Mobizen.Socket.Channel~Task event emmiter

receive(payload, data)

Name Type Description
payload object
data object
TODO
  • 메시지 이름과 이벤트 이름을 통일
Fires:

Responsable packet transfer.

Name Type Description
cmd string
data *
options object optional

sequence options

Name Type Description
params * optional

send data of operational packet

type string optional

transfer type request or stream

channel string optional

channel of socket

timeout number optional

add an error event of timeout

cancel string| function optional

send cancel signal

Returns:
Type Description
Mobizen.Socket.Channel~Task a task of transfer sequence
Example
var task = this.request('some.command', {
    kind: kind,
    id: id
  }).on('end', function(data) {
    // do somthing
  }).on('error', function(type) {
    // do somthing
  });

send(cmd, data){object}

Name Type Description
cmd string
data object
TODO
  • TBD: 메시지 이름과 이벤트 이름을 통일
Throws:
Will throw an error if unknown command
Returns:
Type Description
object data of struct

Implement data transfer sequence.

Name Type Description
action string optional

operational signals

options object

sequence options

Name Type Description
params * optional

send data of operational packet

type string optional

transfer type request or stream

channel string optional

channel of socket

timeout number optional

add an error event of timeout

pause string| function optional

send pause signal

resume string| function optional

send resume signal

cancel string| function optional

send cancel signal

TODO
  • EventEmitter의 `pipe()` `unpipe()` 메서드는 스트림 타입인 경우에만 이곳에서 확장
Returns:
Type Description
Mobizen.Socket.Channel~Task a task of transfer sequence
Example
var task = this.sequence('some.command', {
    type: 'stream',
    params: {
      kind: kind,
      id: id
    },
    timeout: 24000,
    pause: 'some.command.pause',
    resume: 'some.command.resume',
    cancel: 'some.command.cancel'
  }).on('data', function(data) {
    // do somthing
  }).on('end', function(data) {
    // do somthing
  }).on('error', function(type) {
    // do somthing
  });

// send pause signal while stream progress
task.pause();
// send resume signal while stream progress
task.resume();
// send cancel signal while stream progress
task.cancel();
Fires:
Returns:
Type Description
Mobizen.Socket.Channel~Task event emmiter

Streamable packet transfer.

Name Type Description
cmd string
data *
options object optional

sequence options

Name Type Description
params * optional

send data of operational packet

type string optional

transfer type request or stream

channel string optional

channel of socket

timeout number optional

add an error event of timeout

pause string| function optional

send pause signal

resume string| function optional

send resume signal

cancel string| function optional

send cancel signal

Returns:
Type Description
Mobizen.Socket.Channel~Task a task of transfer sequence
Example
var task = this.stream('some.command', {
    kind: kind,
    id: id
  }, {
    timeout: 24000,
    pause: 'some.command.pause',
    resume: 'some.command.resume',
    cancel: function() {
      this.send('some.command.cancel', {type: 1});
    }.bind(this)
  }).on('data', function(data) {
    // do somthing
  }).on('end', function(data) {
    // do somthing
  }).on('error', function(type) {
    // do somthing
  });

// send pause signal while stream progress
task.pause();
// send resume signal while stream progress
task.resume();
// send cancel signal while stream progress
task.cancel();

inherited task(cmd, event, arg1, arg2, arg3){boolean}

The task of a sequence.

Name Type Description
cmd string
event string
arg1 * optional

receive data 1

arg2 * optional

receive data 2

arg3 * optional

receive data 3

Returns:
Type Description
boolean excuted

inner ondatalistenchannel(data, message)

Name Type Description
data object
message string
Listens to Events:

Events

calllog․data

Type:
Name Type Description
data object
Listeners of This Event:

calllog․delete․end

Type:
Name Type Description
data object
TODO
  • calllog 앱에서 응답처리 없음

calllog․end

Type:
Listeners of This Event:

calllog․error

Type:
Name Type Description
data object

calllog․start

Type:
Name Type Description
data object
Listeners of This Event:

contacts․data

Type:
Name Type Description
data object
Listeners of This Event:

contacts․end

Type:
Listeners of This Event:

contacts․error

Type:
Name Type Description
data object

contacts․start

Type:
Name Type Description
data object
Listeners of This Event:

contact․aggregation․data

Type:
Name Type Description
data object

contact․avatar․data

Type:
Name Type Description
data object
Listeners of This Event:

contact․avatar․end

Type:
Name Type Description
data object
TODO
  • 리스너 없음

contact․create․data

Type:
Name Type Description
data object

contact․data

Type:
Name Type Description
data object

contact․delete․data

Type:
Name Type Description
data object
Listeners of This Event:

contact․delete․field․data

Type:
Name Type Description
data object
Listeners of This Event:

contact․groups․data

Type:
Name Type Description
data object
Listeners of This Event:

contact․id․data

Type:
Name Type Description
data object
Listeners of This Event:

contact․id․error

Type:
Name Type Description
data object
Listeners of This Event:

contact․insert․field․data

Type:
Name Type Description
data object
Listeners of This Event:

contact․single․data

Type:
Name Type Description
data object
Listeners of This Event:

contact․update․field․data

Type:
Name Type Description
data object
Listeners of This Event:

files․data

Type:
Name Type Description
data object
Listeners of This Event:

files․end

Type:

file․copymove․cancel

Type:
Name Type Description
data object
message string
Listeners of This Event:

file․copymove․data

Type:
Name Type Description
data object
message string
Listeners of This Event:

file․copymove․error

Type:
Name Type Description
data object
message string
Listeners of This Event:

file․create․data

Type:
Name Type Description
data object
Listeners of This Event:

file․delete․data

Type:
Name Type Description
data object
Listeners of This Event:

file․external․data

Type:
Name Type Description
data object

file․external․end

Type:

file․find․data

Type:
Name Type Description
data object
Listeners of This Event:

file․find․end

Type:
Name Type Description
data object
Listeners of This Event:

file․rename․data

Type:
Name Type Description
data object
Listeners of This Event:

finddevice․error

Type:
Name Type Description
data object

finddevice․location․data

Type:
Name Type Description
data object

finddevice․lockscreen․data

Type:
Name Type Description
data object

finddevice․resetphone․data

Type:
Name Type Description
data object

finddevice․ringchangenoti․data

Type:
Name Type Description
data object

finddevice․ring․data

Type:
Name Type Description
data object

finddevice․ring․data

Type:
Name Type Description
data object

finddevice․track․data

Type:
Name Type Description
data object

input․paste․end

Type:
Name Type Description
data object
Listeners of This Event:

input․status․data

Type:
Name Type Description
data object
type string
Listeners of This Event:

listen․channel․data

Type:
Name Type Description
data object
message string
Listeners of This Event:

login․browser․end

Type:
Name Type Description
data object
Listeners of This Event:

login․local․end

Type:
Name Type Description
data object
Listeners of This Event:

media․music․data

Type:
Name Type Description
data object
Listeners of This Event:

media․music․end

Type:
Name Type Description
channel string

The name of channel of socket.

Listeners of This Event:

media․music․error

Type:
Name Type Description
channel string

The name of channel of socket.

media․music․start

Type:
Name Type Description
data object
Listeners of This Event:

media․photos․data

Type:
Name Type Description
data object
Listeners of This Event:

media․photos․end

Type:
Name Type Description
channel string

The name of channel of socket.

Listeners of This Event:

media․photos․error

Type:
Name Type Description
channel string

The name of channel of socket.

media․photos․start

Type:
Name Type Description
data object
Listeners of This Event:

media․search․data

Type:
Name Type Description
data object
Listeners of This Event:

media․thumbnail․end

Type:
Name Type Description
data object
Listeners of This Event:

inherited media․thumbnail․error

Timeout Error

Type:
Name Type Description
type string

inherited media․thumbnail․load

Type:
Name Type Description
data object

inherited media․thumbnail․timeout

Type:
Name Type Description
data object

media․videos․data

Type:
Name Type Description
data object
Listeners of This Event:

media․videos․end

Type:
Name Type Description
channel string

The name of channel of socket.

Listeners of This Event:

media․videos․error

Type:
Name Type Description
channel string

The name of channel of socket.

media․videos․start

Type:
Name Type Description
data object
Listeners of This Event:

message․contacts․data

Type:
Name Type Description
data object
Listeners of This Event:

message․contact․delete․data

Type:
Name Type Description
data object
Listeners of This Event:

message․conversation․data

Type:
Name Type Description
data object
Listeners of This Event:

message․delete․data

Type:
Name Type Description
data object
Listeners of This Event:

message․error

Type:
Name Type Description
data object

message․search․data

Type:
Name Type Description
data object

message․send․data

Type:
Name Type Description
data object
Listeners of This Event:

notify․data

Type:
Name Type Description
message string
data object
Listeners of This Event:

notify․screen․end

Type:
Name Type Description
data object
Listeners of This Event:

record․end

Type:
Name Type Description
data object
Listeners of This Event:

sdcard․end

Type:
Name Type Description
data object
Listeners of This Event:

share․apps․data

Type:
Name Type Description
data object
Listeners of This Event:

share․apps․end

Type:
Name Type Description
data object
Listeners of This Event:

share․apps․error

Type:
Name Type Description
data object

share․apps․start

Type:
Name Type Description
data object

share․contents․end

Type:
Listeners of This Event:

status․end

Type:
Name Type Description
data object
Listeners of This Event:
comments powered by Disqus