Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hph/web-socket

A Polymer element to ease the use and configuration of WebSockets
https://github.com/hph/web-socket

Last synced: 15 days ago
JSON representation

A Polymer element to ease the use and configuration of WebSockets

Awesome Lists containing this project

README

        

# web-socket [![Build Status](https://travis-ci.org/hph/web-socket.svg?branch=master)](https://travis-ci.org/hph/web-socket)

A [Polymer](https://www.polymer-project.org/1.0/) element to ease the use and
configuration of
[WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket).

```html

```

The above example shows how to establish a WebSocket connection with
`` in a [Polymer](https://www.polymer-project.org) 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 `` with Bower

bower install web-socket

You can also view the [documentation](http://hph.github.io/web-socket), try the
[demo](http://hph.github.io/web-socket/demo) and run the
[tests](http://hph.github.io/web-socket/test).