5.0.0 • Published 2 years ago

isomorphic-ws v5.0.0

Weekly downloads
1,259,172
License
MIT
Repository
github
Last release
2 years ago

isomorphic-ws

Isomorphic implementation of WebSocket.

It uses:

Limitations

Before using this module you should know that ws is not perfectly API compatible with WebSocket, you should always test your code against both Node and browsers.

Some major differences:

  • no Server implementation in browsers
  • no support for the constructor options argument in browsers

Usage

You need to install both this package and ws:

> npm i isomorphic-ws ws

Then just require this package:

const WebSocket = require('isomorphic-ws');

const ws = new WebSocket('wss://echo.websocket.org/');

ws.onopen = function open() {
  console.log('connected');
  ws.send(Date.now());
};

ws.onclose = function close() {
  console.log('disconnected');
};

ws.onmessage = function incoming(data) {
  console.log(`Roundtrip time: ${Date.now() - data.data} ms`);

  setTimeout(function timeout() {
    ws.send(Date.now());
  }, 500);
};

License

MIT

@graphql-tools/url-loader@solve3/modal@dxos/cli@vulppi/data-sync-client@moonlasher/saffronaskless-javascript-clientlozitaflokarisenid-core-testarisenidjs-trial-version2-corearisenidjs-version-two-corethrift-trunkpubsub-ddp-client@chargetrip/javascript-sdk@subscribr/messagecitric-connectorbitpolisjs-wsyounitedjs-wsvelarisjs-wsdigitalstage-client-soundjack@gamesdonequick/bingosync-api@vojtechsimetka/bee-jsnode-okex-apiweb3ynode-api-bybitdogehouse-jsdogehouse.js-stagededbot-studio-client@maroxy/revoltjs@fungi-realtime/coreebird.chat-nodedetherweb3mattermost-client-nodenanocurrency-clienttgam-financebinance_with_coinmws@redesblock/hop.jskwil_messengernejc-flarejsapi-market-ftx-gor-gevyonggui@alphahorizonio/unisockets@infinitebrahmanuniverse/nolb-iso@prodam/prodam-types@oerlikon/uplinkoerlikon-app-frame-uplinkhuya_presenter_thriftjsviem-alphaviem-bundle-testviem-testviem-test-bundleviem-test10viem-test11viem-test12viem-test15viem-test16viem-test18viem-test19viem-test2viem-test20viem-test21viem-test22viem-test23viem-test24viem-test3viem-test4viem-test5viem-test6viem-test7viem-test8viem-test9odin-marketfeed-api-newodin-marketfeed-api-test@everything-registry/sub-chunk-1938wivo-midjourneyfirejaba-midjourneyfirejaba-mjrestify-websocketokx-best-api@dennisrijsdijk/streamdeck-tsjuji-clienthive-fe-fedexjs-tinyrpc@sehyunchung/renegade-core@solarpunk/bee-jscoolkit-wsconstellation-frontendcoinbase-apicoin-canvas-libcoinflectcocosjs-corecocosjs-core-maincombined-cryptos-apicql.jscoolbux-wrappercore-web3-providers-wsdarkchat-clientdataflexdatona-libcryptoapi-lib
5.0.0

2 years ago

5.0.0-beta.2

2 years ago

5.0.0-beta.3

2 years ago

5.0.0-beta.1

2 years ago

4.0.1

6 years ago

4.0.0

7 years ago

3.2.0

7 years ago

2.3.1

7 years ago