W3cubDocs

/Haxe

SocketProtocol

package haxe.remoting

Available on all platforms

The Haxe Remoting Socket Protocol is composed of serialized string exchanges. Each string is prefixed with a 2-chars header encoding the string size (up to 4KB) and postfixed with the \0 message delimiting char.

A request string is composed of the following serialized values :

  • the boolean true for a request
  • an array of strings representing the object+method path
  • an array of parameters

A response string is composed of the following serialized values :

  • the boolean false for a response
  • a serialized value representing the result

Exceptions are serialized with serializeException so they will be thrown immediately when they are unserialized.

Constructor

new (sock:Socket, ctx:Context)

Variables

context:Context

socket:Socket

Methods

dynamic decodeData (data:String):String

encodeMessageLength (len:Int):{c2:Null<Int>, c1:Null<Int>}

isRequest (data:String):Bool

messageLength (c1:Int, c2:Int):Null<Int>

processAnswer (data:String):Dynamic

processRequest (data:String, ?onError:Array<String> ‑> Array<Dynamic> ‑> Dynamic ‑> Void):Void

readMessage ():String

Available on cpp, cs, hl, java, lua, macro, neko, php, python

sendAnswer (answer:Dynamic, ?isException:Bool):Void

sendMessage (msg:String):Void

sendRequest (path:Array<String>, params:Array<Dynamic>):Void

© 2005–2018 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/haxe/remoting/SocketProtocol.html