1.0.5 • Published 4 years ago

socket-envelope v1.0.5

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

SocketEnvelope

Overview

SocketEnvelope is a React component implementation of the WebSocket protocol. Unlike a lot of other implementations, SocketEnvelope actually allows for sending messages to the server, not just reading messages.

Installation

yarn add socket-envelope

Usage

import { SocketEnvelope } from 'socket-envelope';

<SocketEnvelope url={url}
                envelope={envelope}
                onMessage={this.onMessage}
                formatEnvelope={this.formatEnvelope} />
attrtype
urlstring
envelopeobject
onMessagefunc
formatEnvelopefunc

The way SocketEnvelope determines if it should send a message is by comparing the timestamp property on envelope.

The onMessage handler will receive the message event, the payload of which is accessible with event.data.

The formatEnvelope handler will receive the envelope object and should return either a string or binary message.

1.0.5

4 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago