Polymer element to connect to socket.IO WebSocket
[ This description is mirrored from README.md at github.com/Collaborne/iron-socket-io-client on 2019-05-10 ]
Polymer element to connect to socket-IO
This element uses Polymer 2 native classes (ES6 syntax).
bower install --save Collaborne/iron-socket-io-client
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
invoke(uri, [token])to connect to the
/socket.io/location at the given URI. The optional
tokenargument will be used as 'Bearer' token in the
authorizationheader of the initial request.
registerHandler(typePrefix, handler)to receive messages with their
typeproperty starting the with the prefix
typePrefix. 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.
messageevents to the server, or
emit(type, message)to emit events with the given type.
- Monitor event
iron-socket-io-client-errorfor potential errors on the WebSocket connection
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.