isomorphic-ws

WebJar for isomorphic-ws

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

isomorphic-ws
Последняя версия

Последняя версия

4.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

isomorphic-ws
WebJar for isomorphic-ws
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/heineiuo/isomorphic-ws

Скачать isomorphic-ws

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/isomorphic-ws/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>isomorphic-ws</artifactId>
    <version>4.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/isomorphic-ws/
implementation 'org.webjars.npm:isomorphic-ws:4.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/isomorphic-ws/
implementation ("org.webjars.npm:isomorphic-ws:4.0.1")
'org.webjars.npm:isomorphic-ws:jar:4.0.1'
<dependency org="org.webjars.npm" name="isomorphic-ws" rev="4.0.1">
  <artifact name="isomorphic-ws" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='isomorphic-ws', version='4.0.1')
)
libraryDependencies += "org.webjars.npm" % "isomorphic-ws" % "4.0.1"
[org.webjars.npm/isomorphic-ws "4.0.1"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

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

Версии библиотеки

Версия
4.0.1