All Projects → ryo-ma → Deno Websocket

ryo-ma / Deno Websocket

Licence: mit
🦕 A simple WebSocket library like ws of node.js library for deno

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Deno Websocket

Arduinowebsockets
arduinoWebSockets
Stars: ✭ 1,265 (+1609.46%)
Mutual labels:  websocket, websocket-server, websocket-client, ws
Libhv
🔥 比libevent、libuv更易用的国产网络库。A c/c++ network library for developing TCP/UDP/SSL/HTTP/WebSocket client/server.
Stars: ✭ 3,355 (+4433.78%)
Mutual labels:  websocket, websocket-server, websocket-client
Embedded Jetty Websocket Examples
Embedded Jetty WebSocket Examples
Stars: ✭ 159 (+114.86%)
Mutual labels:  websocket, websocket-server, websocket-client
Oatpp Websocket
oatpp-websocket submodule.
Stars: ✭ 26 (-64.86%)
Mutual labels:  websocket, websocket-server, websocket-client
Sketchpad
Sketchpad is fully customisable collaborative whiteboard plugin written in pure JavaScript.
Stars: ✭ 85 (+14.86%)
Mutual labels:  websocket, websocket-server, websocket-client
Php Wss
Web-socket server/client with multi-process and parse templates support on server and send/receive options on client
Stars: ✭ 117 (+58.11%)
Mutual labels:  websocket, websocket-server, websocket-client
Awesome Websockets
A curated list of Websocket libraries and resources.
Stars: ✭ 850 (+1048.65%)
Mutual labels:  websocket, websocket-server, websocket-client
Jiny
Lightweight, modern, simple JVM web framework for rapid development in the API era
Stars: ✭ 40 (-45.95%)
Mutual labels:  websocket, websocket-server, websocket-client
Websockets
Library for building WebSocket servers and clients in Python
Stars: ✭ 3,724 (+4932.43%)
Mutual labels:  websocket, websocket-server, websocket-client
Websocketlistener
A lightweight and scalable asynchronous WebSocket listener
Stars: ✭ 295 (+298.65%)
Mutual labels:  websocket, websocket-server, ws
Beast
HTTP and WebSocket built on Boost.Asio in C++11
Stars: ✭ 3,241 (+4279.73%)
Mutual labels:  websocket, websocket-server, websocket-client
Autobahn Testsuite
Autobahn WebSocket protocol testsuite
Stars: ✭ 603 (+714.86%)
Mutual labels:  websocket, websocket-server, websocket-client
Ws
Simple to use, blazing fast and thoroughly tested WebSocket client and server for Node.js
Stars: ✭ 17,419 (+23439.19%)
Mutual labels:  websocket, websocket-server, websocket-client
Websocket
The Hoa\Websocket library.
Stars: ✭ 421 (+468.92%)
Mutual labels:  websocket, websocket-server, websocket-client
Websocket
A PHP implementation of WebSocket.
Stars: ✭ 54 (-27.03%)
Mutual labels:  websocket, websocket-server, websocket-client
Netcoreserver
Ultra fast and low latency asynchronous socket server & client C# .NET Core library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
Stars: ✭ 799 (+979.73%)
Mutual labels:  websocket, websocket-server
Cowboy
Small, fast, modern HTTP server for Erlang/OTP.
Stars: ✭ 6,533 (+8728.38%)
Mutual labels:  websocket, websocket-server
Cebsocket
Lightweight WebSocket library for C.
Stars: ✭ 73 (-1.35%)
Mutual labels:  websocket, websocket-server
Starscream
Websockets in swift for iOS and OSX
Stars: ✭ 7,105 (+9501.35%)
Mutual labels:  websocket, websocket-client
Gun
HTTP/1.1, HTTP/2 and Websocket client for Erlang/OTP.
Stars: ✭ 710 (+859.46%)
Mutual labels:  websocket, websocket-client
logo

deno websocket

deno doc GitHub nest badge

🦕 A simple WebSocket library like ws of node.js library for deno

  • Deno >= 1.7.2

Quick Start

Example Demo

demo

Server side

$ deno run --allow-net https://deno.land/x/[email protected]/example/server.ts

Client side

$ deno run --allow-net https://deno.land/x/[email protected]/example/client.ts
ws connected! (type 'close' to quit)
> something

Usage

Server side

import { WebSocketClient, WebSocketServer } from "https://deno.land/x/[email protected]/mod.ts";

const wss = new WebSocketServer(8080);
wss.on("connection", function (ws: WebSocketClient) {
  ws.on("message", function (message: string) {
    console.log(message);
    ws.send(message)
  });
});

Client side

import { WebSocketClient, StandardWebSocketClient } from "https://deno.land/x/[email protected]/mod.ts";
const endpoint = "ws://127.0.0.1:8080";
const ws: WebSocketClient = new StandardWebSocketClient(endpoint);
ws.on("open", function() {
  console.log("ws connected!");
});
ws.on("message", function (message: string) {
  console.log(message);
});
ws.send("something");

Documentation

WebSocketServer

Event

event detail
connection Emitted when the handshake is complete
error Emitted when an error occurs

Field

field detail type
server.clients A set that stores all connected clients Set<WebSocket>

Method

method detail
close() Close the server

WebSocketClient

Event

event detail
open Emitted when the connection is established
close Emitted when the connection is closed
message Emitted when a message is received from the server
ping Emitted when a ping is received from the server
pong Emitted when a pong is received from the server
error Emitted when an error occurs

Field

field detail type
websocket.isClose Get the close flag Boolean | undefined

Method

method detail
send(message:string | Unit8Array) Send a message
ping(message:string | Unit8Array) Send the ping
close([code:int[, reason:string]]) Close the connection with the server
forceClose() Forcibly close the connection with the server

LICENSE

MIT LICENSE

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].