@eleven-am/pondsocket-common
v0.0.41
Published
Shared protocol, schema, routing, and observable primitives for PondSocket.
Downloads
674
Maintainers
Readme
PondSocket Common
Shared TypeScript definitions and runtime primitives used by the PondSocket server and clients.
Most applications should install @eleven-am/pondsocket or @eleven-am/pondsocket-client; those packages install this package automatically. Import it directly when sharing schemas between a server and a client:
import { definePondChannel, definePondSchema } from '@eleven-am/pondsocket-common';
interface ChatSchema {
events: {
message: {
request: { text: string };
response: { delivered: boolean };
};
};
assigns: { userId: string };
presence: { online: boolean };
}
export const Chat = definePondChannel(
definePondSchema<ChatSchema>(),
'/chat/:roomId',
);