🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@lokalise/websockets-common

Package Overview
Dependencies
Maintainers
20
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lokalise/websockets-common

This package contains core websocket system events and tools that can be used by backend and frontend services

latest
Source
npmnpm
Version
4.2.0
Version published
Maintainers
20
Created
Source

Websockets common package

This package contains core websocket system events and tools that can be used by backend and frontend services

Getting started

Server to Client events and vice-versa

Events are separated into two groups

  • Server to Client events (server-to-client)
  • Client to Server events (client-to-server)

The names are pretty self-explanatory, but the gist of it is - these dictate which events can be subscribed to and which events can be emitted. For example the Server can only subscribe to client-to-server events and can only emit server-to-client events.

Event schemas

Event schema is a Zod object. The object will be passed as an argument for the event.

const DEMO_EVENT_SCHEMA = z.object({
	first: z.string(),
	second: z.string(),
})

Creating an event contract

An event contract is basically an object containing entries with a schema. Each key in that object represents the event name. Here is an example event definition.

export const DemoEvents = {
	'users.demo.request': {
		schema: DEMO_EVENT_SCHEMA,
	},
}

You can split your definitions into multiple files/objects and combine them later.

export const MyEvents = {
	...DemoEvents,
	...SomeOtherEvents,
}

FAQs

Package last updated on 28 Nov 2025

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