Skip to content
/ web-socket Public

A Polymer element to ease the use and configuration of WebSockets

License

Notifications You must be signed in to change notification settings

hph/web-socket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

web-socket Build Status

A Polymer element to ease the use and configuration of WebSockets.

<web-socket url="ws://echo.websocket.org"
            auto json
            on-open="_onOpen"
            on-close="_onClose"
            on-message="_onMessage"
            on-error="_onError">
</web-socket>

The above example shows how to establish a WebSocket connection with <web-socket> in a Polymer app. This simple declarative element definition is:

  • Establishing a connection to ws://echo.websocket.org.
  • Automatically connecting on page load.
  • Parsing and stringifying JSON automatically.
  • Automatically reconnecting in the event of an unclean close event (a default behaviour of this library - no configuration required through properties).
  • Setting up event handlers to functions declared externally (_onOpen, _onClose, etc - defined by a parent element, such as a page).

Install

You can install <web-socket> with Bower

bower install web-socket

You can also view the documentation, try the demo and run the tests.

About

A Polymer element to ease the use and configuration of WebSockets

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages