# TypeScript Proto Socket Status: available This package implements Proto Socket protocol version `0.1` for TypeScript. ## Scope - Runtime targets: Node.js TCP, Node.js WebSocket, browser native WebSocket. - Browser entrypoint (`proto-socket`): `Communicator`, `BaseClient`, `BrowserWsClient`, `connectBrowserWs`. Has no `ws`, `node:*`, or `Buffer` dependency. - Node entrypoint (`proto-socket/node`): all of the above plus `TcpClient`/`TcpServer`, `NodeWsClient`/`NodeWsServer`, `connectNodeWs`/`connectNodeWss` using Node.js built-ins. ## Import ```ts // browser import { connectBrowserWs } from "proto-socket"; // node import { connectNodeWs, NodeWsServer, TcpClient } from "proto-socket/node"; ``` ## Runtime Dependencies The TypeScript runtime has no non-protobuf package dependencies. The current canonical message codec and Node.js TCP/TLS/WebSocket transports are implemented with native platform APIs, so this package has no runtime dependencies at all. ## Proto Sync The canonical schema lives in `../proto/message_common.proto`. The TypeScript packet codec in `src/packets/` must stay wire-compatible with that schema. After proto changes, run from the repository root: ```bash tools/check_proto_sync.sh ``` ## Validation ```bash cd typescript npx tsc --noEmit npx vitest run ``` ```bash cd go go run ./crosstest/go_typescript.go ``` ```bash cd dart dart run crosstest/dart_typescript.dart ``` ```bash cd kotlin ./gradlew run -PmainClass=com.tokilabs.proto_socket.crosstest.KotlinTypescriptKt ``` ```bash cd python python3 crosstest/python_typescript.py ``` ```bash cd typescript ./node_modules/.bin/tsx crosstest/typescript_dart.ts ./node_modules/.bin/tsx crosstest/typescript_go.ts ./node_modules/.bin/tsx crosstest/typescript_kotlin.ts ./node_modules/.bin/tsx crosstest/typescript_python.ts ```