ctrl-react-web-socket

2.2.0 • Public • Published

ctrl-react-web-socket

Build Status Codacy Badge Codacy Badge

A React component that abstracts around socket.io-client.

Installation

Yarn is recommended for installation.

$ yarn add --dev ctrl-react-web-socket
$ npm install --save-dev ctrl-react-web-socket

Usage

import {WebSocketClient} from 'ctrl-react-web-socket'
import ReactDOM from 'react-dom'
 
import App from './App.jsx'
 
ReactDOM.render(
  <WebSocketClient url='http://localhost:8080'>
    <App/>
  </WebSocketClient>
, document.querySelector('#container')
)

App will inherit a property called webSocket that contains an emit method and an isConnected state.

Methods

Full documentation to come soon!

License

Copyright (c) 2016 Martin Experiments LLC

MIT (https://www.opensource.org/licenses/MIT)

/ctrl-react-web-socket/

    Package Sidebar

    Install

    npm i ctrl-react-web-socket

    Weekly Downloads

    3

    Version

    2.2.0

    License

    MIT

    Last publish

    Collaborators

    • suitupalex