Skip to content

Latest commit

 

History

History
45 lines (38 loc) · 1.11 KB

README.md

File metadata and controls

45 lines (38 loc) · 1.11 KB

Global Sigleton Websocket Client for React JS

NuGet version

Installation

npm i global-websocket-client

Usage Example

import React, { Component } from "react";
import WebSocketClient from "../../src";

class Demo extends Component {
  state = {
    WebSocketUri: 'wss://echo.websocket.org'
  };

  componentDidMount(){
    WebSocketClient.connect(
      this.state.WebSocketUri,
      this.openCallback,
      this.onErrorCallback,
      this.onMessageCallback,
      this.onCloseCallback
    );
  };
  render() {
    return (
      <div>
        <h1>global-websocket-client</h1>
      </div>
    );
  }
}