WS Plugin API reference |
WebSocket plugin. |
simWS.send
simWS.setCloseHandler
simWS.setFailHandler
simWS.setHTTPHandler
simWS.setMessageHandler
simWS.setOpenHandler
simWS.start
simWS.stop
|
simWS.send
Description
|
Send data over the socket.
|
Lua synopsis |
simWS.send(string serverHandle, string connectionHandle, string data, int opcode=sim_ws_opcode_text)
|
Lua parameters |
serverHandle (string):
connectionHandle (string):
data (string):
opcode (int, default: sim_ws_opcode_text):
|
Lua return values |
|
Python synopsis |
simWS.send(string serverHandle, string connectionHandle, string data, int opcode=sim_ws_opcode_text)
|
See also
|
|
simWS.setCloseHandler
Description
|
The close handler is called once for every successfully
established connection after it is no longer capable of sending or
receiving new messages.
|
Lua synopsis |
simWS.setCloseHandler(string serverHandle, string callbackFn)
|
Lua parameters |
serverHandle (string):
callbackFn (string):
|
Lua return values |
|
Python synopsis |
simWS.setCloseHandler(string serverHandle, string callbackFn)
|
See also
|
|
simWS.setFailHandler
Description
|
The fail handler is called once for every unsuccessful
WebSocket connection attempt. Either the fail handler or the open
handler will be called for each WebSocket connection attempt. HTTP
Connections that did not attempt to upgrade the connection to the
WebSocket protocol will trigger the http handler instead of fail/open.
|
Lua synopsis |
simWS.setFailHandler(string serverHandle, string callbackFn)
|
Lua parameters |
serverHandle (string):
callbackFn (string):
|
Lua return values |
|
Python synopsis |
simWS.setFailHandler(string serverHandle, string callbackFn)
|
See also
|
|
simWS.setHTTPHandler
Description
|
The http handler is called when an HTTP connection is made
that does not attempt to upgrade the connection to the WebSocket
protocol. This allows to deliver error pages and static files such as
the base HTML and JavaScript for an otherwise single page WebSocket
application. Note: The HTTP handler is appropriate only for low volume
HTTP traffic. If you expect to serve high volumes of HTTP traffic a
dedicated HTTP web server is strongly recommended.
|
Lua synopsis |
simWS.setHTTPHandler(string serverHandle, string callbackFn)
|
Lua parameters |
serverHandle (string):
callbackFn (string):
|
Lua return values |
|
Python synopsis |
simWS.setHTTPHandler(string serverHandle, string callbackFn)
|
See also
|
|
simWS.setMessageHandler
Description
|
The message handler is called after a new message has been received.
|
Lua synopsis |
simWS.setMessageHandler(string serverHandle, string callbackFn)
|
Lua parameters |
serverHandle (string):
callbackFn (string):
|
Lua return values |
|
Python synopsis |
simWS.setMessageHandler(string serverHandle, string callbackFn)
|
See also
|
|
simWS.setOpenHandler
Description
|
The open handler is called once for every successful
WebSocket connection attempt. Either the fail handler or the open
handler will be called for each WebSocket connection attempt. HTTP
Connections that did not attempt to upgrade the connection to the
WebSocket protocol will trigger the http handler instead of fail/open.
|
Lua synopsis |
simWS.setOpenHandler(string serverHandle, string callbackFn)
|
Lua parameters |
serverHandle (string):
callbackFn (string):
|
Lua return values |
|
Python synopsis |
simWS.setOpenHandler(string serverHandle, string callbackFn)
|
See also
|
|
simWS.start
Description
|
Set up endpoint for listening on a port, and starts the server's async connection acceptance loop.
|
Lua synopsis |
string serverHandle=simWS.start(int listenPort)
|
Lua parameters |
listenPort (int): |
Lua return values |
serverHandle (string): |
Python synopsis |
string serverHandle=simWS.start(int listenPort)
|
See also
|
|
simWS.stop
Description
|
Stop and destroy the server.
|
Lua synopsis |
simWS.stop(string serverHandle)
|
Lua parameters |
serverHandle (string): |
Lua return values |
|
Python synopsis |
simWS.stop(string serverHandle)
|
See also
|
|
|
Constants
Constants used in the various functions. Refer to each constant using enumName.constantName, i.e. simUI.curve_type.xy for xy constant in simUI.curve_type enum.
simWS.opcode
|
|
Script functions
Script functions are used to call some lua code from the plugin side (tipically used for event handlers).
openCallback
Description
|
|
Lua synopsis |
simWS.openCallback(string serverHandle, string connectionHandle)
|
Lua parameters |
serverHandle (string):
connectionHandle (string):
|
Lua return values |
- |
Python synopsis |
simWS.openCallback(string serverHandle, string connectionHandle)
|
See also
|
|
failCallback
Description
|
|
Lua synopsis |
simWS.failCallback(string serverHandle, string connectionHandle)
|
Lua parameters |
serverHandle (string):
connectionHandle (string):
|
Lua return values |
- |
Python synopsis |
simWS.failCallback(string serverHandle, string connectionHandle)
|
See also
|
|
closeCallback
Description
|
|
Lua synopsis |
simWS.closeCallback(string serverHandle, string connectionHandle)
|
Lua parameters |
serverHandle (string):
connectionHandle (string):
|
Lua return values |
- |
Python synopsis |
simWS.closeCallback(string serverHandle, string connectionHandle)
|
See also
|
|
messageCallback
Description
|
|
Lua synopsis |
simWS.messageCallback(string serverHandle, string connectionHandle, string data)
|
Lua parameters |
serverHandle (string):
connectionHandle (string):
data (string):
|
Lua return values |
- |
Python synopsis |
simWS.messageCallback(string serverHandle, string connectionHandle, string data)
|
See also
|
|
httpCallback
Description
|
|
Lua synopsis |
int status, string data=simWS.httpCallback(string serverHandle, string connectionHandle, string resource, string data)
|
Lua parameters |
serverHandle (string):
connectionHandle (string):
resource (string):
data (string):
|
Lua return values |
status (int):
data (string):
|
Python synopsis |
int status, string data=simWS.httpCallback(string serverHandle, string connectionHandle, string resource, string data)
|
See also
|
|
|