Compare commits

..

No commits in common. "v0.1.0-develop.16" and "v0.1.0-develop.15" have entirely different histories.

4 changed files with 6 additions and 13 deletions

View File

@ -1,10 +1,3 @@
# [0.1.0-develop.16](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.15...v0.1.0-develop.16) (2023-09-01)
### Bug Fixes
* add support for browser WS by checking if we are in node ([0a15337](https://git.lumeweb.com/LumeWeb/libs5/commit/0a153379c87ebbee8c7d7b3015fe4c1b77f379ca))
# [0.1.0-develop.15](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.14...v0.1.0-develop.15) (2023-09-01)
# [0.1.0-develop.14](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.13...v0.1.0-develop.14) (2023-08-31)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@lumeweb/libs5",
"version": "0.1.0-develop.16",
"version": "0.1.0-develop.15",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/libs5",
"version": "0.1.0-develop.16",
"version": "0.1.0-develop.15",
"dependencies": {
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/libs5",
"version": "0.1.0-develop.16",
"version": "0.1.0-develop.15",
"type": "module",
"main": "lib/index.js",
"repository": {

View File

@ -1,8 +1,8 @@
import { Logger, Peer } from "../types.js";
import NodeId from "../nodeId.js";
import { URL } from "url";
import * as WS from "ws";
import { WebSocket } from "ws";
import { BasePeer } from "#transports/base.js";
import isNode from "detect-node";
export class WebSocketPeer extends BasePeer implements Peer {
sendMessage(message: Uint8Array): void {
@ -39,7 +39,7 @@ export class WebSocketPeer extends BasePeer implements Peer {
public static async connect(uri: URL): Promise<WebSocket> {
return new Promise((resolve, reject) => {
const socket = isNode ? new WS.WebSocket() : new WebSocket(uri);
const socket = new WebSocket(uri);
socket.addEventListener("open", () => {
resolve(socket);
});