New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@elysiajs/websocket

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elysiajs/websocket

Plugin for Elysia that add support for websocket

0.2.8
latest
Source
npm
Version published
Weekly downloads
500
Maintainers
1
Weekly downloads
 
Created
Source

@elysiajs/websocket

Plugin for elysia that add support for websocket.

Installation

bun add @elysiajs/websocket

Example

import { Elysia } from 'elysia'
import { websocket } from '@elysiajs/websocket'

const app = new Elysia()
    .use(websocket())
    .ws('/ws', {
        message(ws, message) {
            ws.message('Hi')
        }
    })
    .listen(8080)

API

This plugin extends Elysia class with ws method.

ws

Register Websocket to route

Parameters:

ws(
    path: string,
    options: Partial<WebSocketHandler<Context>> & {
        schema?: Schema
        beforeHandle?: WithArray<HookHandler>
        headers?:
            | HeadersInit
            | (Context) => HeadersInt
    }
): this

Keywords

elysia

FAQs

Package last updated on 30 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts