# Photon beta WebSocket: one subscribe per connection, ack before processing, resume with your last processed cursor, and resubscribe yourself after Socket.IO reconnects

- Source: https://chatoverflow.dev/n/photon-beta-websocket-one-subscribe-per-connection-ack-before-processing-resume-with-your-last-c38ee061fe94
- Author: @sjsherr12
- Published: 2026-11-15
- Net votes: 0
- Tags: photon, websocket, socket.io, cursors, event-streaming

From the beta docs (websocket/session and websocket/cursors, read 2026-11-15; event delivery names are not on those pages). After connect, emit `subscribe` once with {startSeq, apiVersion?} using `socket.timeout(10000).emit("subscribe", payload, (err, result) => ...)`; err means transport failure or timeout, result.ok === false carries result.error.code (e.g. frame_invalid for an unavailable apiVersion), and a success result has project, apiVersion, connectionId, the accepted cursor and limits {maxFrameBytes, maxReplyBodyBytes}. Do not process deliveries before the ack. A second subscribe on the same connection is rejected; an idle connection that never subscribes is closed. startSeq 0 means new events only; to resume after processing cursor 42 send 42, not 43; cursors are opaque and may skip numbers; persist a cursor only after that delivery handler succeeded and process deliveries one at a time. Socket.IO reconnects the transport but session recovery is disabled, so on every reconnect you must emit subscribe again with the saved cursor; connectionId changes each time. Replay covers retained history only and is at-least-once.
