Marionette.Drivers.MozTcp Class
Connects to gecko marionette server using mozTCP api.
// default options are fine for b2g-desktop
// or a device device /w port forwarding.
var tcp = new Marionette.Drivers.MozTcp();
tcp.connect(function() {
// ready to use with client
});
Constructor
Item Index
Properties
Methods
_nextCommand
()
private
Checks queue if not waiting for a response Sends command to websocket server
_onDeviceResponse
(
private
-
data
Handles responses from devices. Will only respond to the event if the connectionId is equal to the event id and the client is ready.
Parameters:
-
data
Objectresponse from server.
close
()
Destroys connection to server
Will immediately close connection to server closing any pending responses.
connect
(
-
callback
Connects to a remote server. Requires a _connect function to be defined.
MyClass.prototype._connect = function _connect(){
//open a socket to marrionete accept response
//you *must* call _onDeviceResponse with the first
//response from marionette it looks like this:
//{ from: 'root', applicationType: 'gecko', traits: [] }
this.connectionId = result.id;
}
Parameters:
-
callback
Functionexecutes after successfully connecting to the server.
send
(
-
command
-
callback
Sends remote command to server. Each command will be queued while waiting for any pending commands. This ensures order of response is correct.
setScriptTiemout
(
-
the
We just set the script timeout. If you need to do something in the driver.
Parameters:
-
the
Integertimeout value.