Web Component: j-WebSocket

  • Info
  • HTML
  • JS
  • CSS
  • Meta


With this component, you can receive data via WebSocket. This component supports auto-reconnect to WebSocket when the connection is closed.


  • 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)
  • NEW message {String} a link to method function(msg)
  • NEW online {String} a link to method function(isonline)


  • 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


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