package services import ( "git.saqut.com/saqut/mwse/internal/protocol" "git.saqut.com/saqut/mwse/internal/ws" ) // registerYourID sends two signals on every new connection: // // 1. wsts/hello — version handshake. The SDK checks this version against its own // constant (sdk/version.js) and refuses to proceed if they differ. The codecs // list advertises which frame encodings the server supports (0 = JSON, 1 = // binary once #42 is ready). This signal is sent first so the SDK can gate // all subsequent processing on a successful version check. // // 2. id — the client's own socket id, exactly as the original Node YourID did. func registerYourID(hub *ws.Hub) { hub.OnConnect(func(c *ws.Client) { c.Signal("wsts/hello", map[string]any{ "v": protocol.WSTSVersion, "codecs": []int{protocol.WSTSCodecJSON}, }) c.Signal("id", map[string]any{"type": "id", "value": c.ID}) }) }