iron-socket-io-client:
[ This description is mirrored from README.md at github.com/Collaborne/iron-socket-io-client on 2019-05-10 ]
iron-socket-io-client

Polymer element to connect to socket-IO
This element uses Polymer 2 native classes (ES6 syntax).
Install
bower install --save Collaborne/iron-socket-io-client
Usage
The component provides an imperative interface to connect to a Socket.IO server. The messages emitted by the server must use the event message, and must be objects with minimally a type property. Handlers can be defined based on (a prefix of) the type property of the messages.
- Embed the component
- Call
invoke(uri, [token])to connect to the/socket.io/location at the given URI. The optionaltokenargument will be used as ‘Bearer’ token in theauthorizationheader of the initial request. - Call
registerHandler(typePrefix, handler)to receive messages with theirtypeproperty starting the with the prefixtypePrefix. The handler is invoked with the complete message as argument, and any return value of the handler is ignored. All handlers matching a message are involved in the order of registration. - Call
send(message)to sendmessageevents to the server, oremit(type, message)to emit events with the given type. - Monitor event
iron-socket-io-client-errorfor potential errors on the WebSocket connection
License
This software is licensed under the Apache 2 license, quoted below.
Copyright 2011-2017 Collaborne B.V. <http://github.com/Collaborne/>
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.