Web component: j-WebSocket


  • Info
  • HTML
  • JS
  • CSS
  • Meta

j-WebSocket

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

Configuration:

  • url {String} URL for websocket, it can be relative or absolute
  • reconnect {Number} can contain only number (milliseconds, default: 2000)
  • bind {Boolean} enables a binding of value according to the component path (default: false)

Methods:

  • component.send(obj) - sends JSON serialized object to the server
  • component.close() - closes connection
  • component.connect() - opens connection

Events:

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

Author

Browser‘s Save action performs Preview