0.3.2 • Published 5 years ago
react-native-reconnecting-websocket-client v0.3.2
RN Reconnecting WebSocket with 2 Groups of Clients
Used for communication between two types of clients, producers and consumers.
Implementation
import BTSWebSocket from "react-native-reconnecting-websocket-client";
const socket = new BTSWebSocket("https://localhost:8080", null, {
userType: "consumer"
});
BTSWebSocket extends ReconnectingWebSocket from this package and uses all its methods plus a couple of things
Options
The same options + userType, takes a string value of either "consumer" or "producer".
Methods
BTSWebSocket.broadcast(event, data)
event
:"update"
for normal broadcasts,"emergency"
for fatal broadcasts.data
: can be anything.