Socket
Socket
Sign inDemoInstall

@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


Version published
Weekly downloads
274
decreased by-31.33%
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

FAQs

Package last updated on 24 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc