Web Component: j-WebSocket
j-WebSocket
With this component, you can receive data via WebSocket. This component supports auto-reconnect to WebSocket when the connection is closed.
- jComponent
v19|v20
Configuration:
url{String}URL for websocket, it can be relative or absolutereconnect{Number}can contain only a number (milliseconds, default:2000)bind{Boolean}enables binding of value according to the componentpath(default:false)encoder{Boolean}performs encode/decode messages viaURI(default:false)message{String}a link to methodfunction(msg)online{String}a link to methodfunction(isonline)- NEW:
statsinterval{Number}stats interval in milliseconds (default:1000) - NEW:
stats{String}a link to methodfunction({ received: Number, sent: Number })or path to a variable (measured in bytes)
Methods:
component.send(obj)- sends JSON serialized object to the servercomponent.close()- closes connectioncomponent.connect()- opens connectioncomponent.idle(is)- NEW can cancel/reopen connection
Events:
ON('message', function(data) {})- received dataON('online', function(isOnline) {})- online/offline
Author
- Peter Širka petersirka@gmail.com
- License
Created
28. july 2016
Updated
05. march 2025
jComponent library
19
Version
v1
License
https://www.totaljs.com/license/
Responsive
Yes
Author
Peter Širka
Email
petersirka@gmail.com

