Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

DanielContrerasAladro/web-socket

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status License Published on webcomponents.org

<web-socket>

A Polymer 2.0 element to ease the usage of WebSockets.

Watch a live demo ↗

Install dependencies and run the demo locally

  1. Install all dependencies via Bower in the repo directory:
    bower install
  1. Run the demo automatically in your browser via the Polymer development server part of Polymer CLI from the project directory:
    polymer serve --open

Usage

<web-socket auto
            url="{{url}}"
            protocols="{{protocols}}"
            state="{{state}}"
            last-request="{{request}}"
            last-response="{{response}}"
            last-error="{{error}}"
            verbose>
</web-socket>

The above example illustrates the usage of <web-socket> in a Polymer app.

Attributes explained:

  • auto = Enables auto connection with page load
  • url = The URL to which to connect
  • protocols = An optional property to provide a single protocol string or an array of protocol strings.
  • state = The current state of the WebSocket connection. Notifies about state changes: WebSocket.readyState
  • last-request = The most recent request made by this web-socket element.
  • last-response = The most recent response received by this web-socket element.
  • last-error = The most recent error received by this web-socket element. If any error occurred.
  • verbose = Enables verbose mode

Run your own prototype WebSocket-Server without great effort

Almost all demo references uses wss://echo.websocket.org/ as WebSocket-Server. This demo makes no difference. If you search for a local alternative, you can get up and running in minutes with httpwebsockethandler by SevenW.

About

A Polymer 2.0 element to ease the usage of WebSockets.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • HTML 100.0%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.