ryo-ma / deno-websocket

🦕 A simple WebSocket library like ws of node.js library for deno
https://deno.land/x/websocket
MIT License
152 stars 18 forks source link

how to import into javascript #25

Closed vinnitu closed 3 years ago

vinnitu commented 3 years ago
import { StandardWebSocketClient } from "https://deno.land/x/websocket@v0.1.2/mod.ts";

const endpoint = "ws://127.0.0.1:8080";

const ws = new StandardWebSocketClient(endpoint);

ws.on("open", function() {
  console.log("ws connected!");
});

ws.on("message", function (message) {
  console.log(message);
});

ws.send("something");
$ deno run --allow-net client.js
error: Uncaught SyntaxError: The requested module 'https://deno.land/x/websocket@v0.1.2/mod.ts' does not provide an export named 'WebSocketClient'
import { WebSocketClient, StandardWebSocketClient } from "https://deno.land/x/websocket@v0.1.2/mod.ts";
         ~~~~~~~~~~~~~~~
    at <anonymous> (file:///home/user/project/client.js:1:10)
vinnitu commented 3 years ago

seems it works in current version deno