Skip to content

Files

Latest commit

 

History

History

j-WebSocket

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

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 absolute
  • reconnect {Number} can contain only a number (milliseconds, default: 2000)
  • bind {Boolean} enables binding of value according to the component path (default: false)
  • encoder {Boolean} performs encode/decode messages via URI (default: false)
  • message {String} a link to method function(msg)
  • online {String} a link to method function(isonline)
  • NEW: statsinterval {Number} stats interval in milliseconds (default: 1000)
  • NEW: stats {String} a link to method function({ received: Number, sent: Number }) or path to a variable (measured in bytes)

Methods:

  • component.send(obj) - sends JSON serialized object to the server
  • component.close() - closes connection
  • component.connect() - opens connection
  • component.idle(is) - NEW can cancel/reopen connection

Events:

  • ON('message', function(data) {}) - received data
  • ON('online', function(isOnline) {}) - online/offline

Author