Ticket #1013 (new Enhancement)

Opened 8 years ago

Last modified 8 years ago

Websockets module: client-side websocket support

Reported by: jri Owned by: jri
Priority: Major Milestone: Release 4.8.4
Component: 3rd Party Plugins Version: 4.8.3
Keywords: Cc: dgf, Malte
Complexity: 3 Area:


Change History

comment:1 Changed 8 years ago by jri

In https://github.com/jri/dm4-websockets/commit/3250f3ba

Client-side API:

create_websocket(url, plugin_uri, message_processor)

Creates a WebSocket connection.
The created WebSocket auto-reconnects once timed out by the browser (usually every 5 minutes).
WebSocket messages are expected to be JSON. Serialization/Deserialization performs automatically.

@param   url
             the URL to connect to.
@param   plugin_uri
             the URI of the calling plugin.
@param   message_processor
             the function that processes incoming messages.
             One argument is passed: the message pushed by the server (a deserialzed JSON object).

@return  The created WebSocket object, wrapped as a DM4 proprietary object.
         This object provides a "send_message" function which takes 1 argument: the message to be
         sent to the server. The argument will be automatically serialized as a JSON object.
Note: See TracTickets for help on using tickets.