Help us shape the future of Go! Take the 2026 Go Developer Survey

ws

package
v0.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptSheetOp added in v0.6.5

type AcceptSheetOp struct {
	Type string            `json:"type"` // "COLLABROOM"
	Data AcceptSheetOpData `json:"data"`
}

AcceptSheetOp acknowledges the sender's own op. Sent as ["message", AcceptSheetOp].

type AcceptSheetOpData added in v0.6.5

type AcceptSheetOpData struct {
	Type   string `json:"type"` // "ACCEPT_SHEET_OP"
	NewRev int    `json:"newRev"`
}

type ChangesetReq added in v0.0.2

type ChangesetReq struct {
	Event string `json:"event"`
	Data  struct {
		Component string `json:"component"`
		Type      string `json:"type"`
		PadId     string `json:"padId"`
		Token     string `json:"token"`
		Data      struct {
			Start       int `json:"start"`
			Granularity int `json:"granularity"`
			RequestID   int `json:"requestID"`
		} `json:"data"`
	} `json:"data"`
}

type ChatBroadCastMessage added in v0.0.2

type ChatBroadCastMessage struct {
	Type string `json:"type"`
	Data struct {
		Type    string               `json:"type"`
		Message ChatMessageSendEvent `json:"message"`
	} `json:"data"`
}

type ChatMessage added in v0.0.2

type ChatMessage struct {
	Event string `json:"event"`
	Data  struct {
		Type      string `json:"type"`
		Component string `json:"component"`
		Data      struct {
			Type    string          `json:"type"`
			Message ChatMessageData `json:"message"`
		}
	}
}

type ChatMessageData added in v0.0.2

type ChatMessageData struct {
	Text        string  `json:"text"`
	Time        *int64  `json:"time,omitempty"`
	UserId      *string `json:"userId,omitempty"`
	AuthorId    *string `json:"authorId,omitempty"`
	DisplayName *string `json:"displayName,omitempty"`
	UserName    *string `json:"userName,omitempty"`
}

func FromObject added in v0.0.2

func FromObject(original ChatMessageData) ChatMessageData

type ChatMessageSendData added in v0.0.2

type ChatMessageSendData struct {
	Text     string  `json:"text"`
	Time     *int64  `json:"time,omitempty"`
	UserId   *string `json:"userId,omitempty"`
	UserName *string `json:"userName,omitempty"`
}

type ChatMessageSendEvent added in v0.0.2

type ChatMessageSendEvent struct {
	Text     string  `json:"text"`
	Time     *int64  `json:"time,omitempty"`
	UserId   *string `json:"userId,omitempty"`
	UserName *string `json:"userName"`
}

type ClientMessage added in v0.6.3

type ClientMessage struct {
	Event string            `json:"event"`
	Data  ClientMessageData `json:"data"`
}

ClientMessage is the COLLABROOM CLIENT_MESSAGE family from the original protocol. The payload type selects the sub-message: "suggestUserName" relays a name suggestion to an unnamed user, "padoptions" distributes pad-wide settings.

type ClientMessageData added in v0.6.3

type ClientMessageData struct {
	Component string                `json:"component"`
	Type      string                `json:"type"`
	Data      ClientMessageDataData `json:"data"`
}

type ClientMessageDataData added in v0.6.3

type ClientMessageDataData struct {
	Type    string               `json:"type"`
	Payload ClientMessagePayload `json:"payload"`
}

type ClientMessagePayload added in v0.6.3

type ClientMessagePayload struct {
	Type      string         `json:"type"`
	NewName   string         `json:"newName,omitempty"`
	UnnamedId string         `json:"unnamedId,omitempty"`
	Options   map[string]any `json:"options,omitempty"`
}

type ClientReady

type ClientReady struct {
	Event string          `json:"event"`
	Data  ClientReadyData `json:"data"`
}

type ClientReadyData added in v0.0.4

type ClientReadyData struct {
	Component string `json:"component"`
	Type      string `json:"type"`
	PadID     string `json:"padId"`
	Token     string `json:"token"`
	// SessionID is the deprecated legacy field for the integrator-set
	// sessionID cookie value, kept for backward compatibility with old
	// clients. Current clients no longer forward it; the server now reads
	// the cookie directly from the socket.io handshake so the cookie can
	// be marked HttpOnly. Upstream #7045 / #7755.
	SessionID string              `json:"sessionID,omitempty"`
	UserInfo  ClientReadyUserInfo `json:"userInfo"`
	Reconnect *bool               `json:"reconnect"`
	ClientRev *int                `json:"client_rev"`
}

type ClientReadyUserInfo added in v0.0.4

type ClientReadyUserInfo struct {
	ColorId *string `json:"colorId"`
	Name    *string `json:"name"`
}

type GetChatMessages added in v0.0.2

type GetChatMessages struct {
	Event string `json:"event"`
	Data  struct {
		Type      string `json:"type"`
		Component string `json:"component"`
		Data      struct {
			Type  string `json:"type"`
			Start int    `json:"start"`
			End   int    `json:"end"`
		} `json:"data"`
	}
}

type GetChatMessagesResponse added in v0.0.2

type GetChatMessagesResponse struct {
	Type string `json:"type"`
	Data struct {
		Type     string                `json:"type"`
		Messages []ChatMessageSendData `json:"messages"`
	} `json:"data"`
}

type NewSheetOp added in v0.6.5

type NewSheetOp struct {
	Type string         `json:"type"` // "COLLABROOM"
	Data NewSheetOpData `json:"data"`
}

NewSheetOp broadcasts a rebased op to the other clients of a sheet. Sent as ["message", NewSheetOp].

type NewSheetOpData added in v0.6.5

type NewSheetOpData struct {
	Type   string          `json:"type"` // "NEW_SHEET_OP"
	Op     json.RawMessage `json:"op"`
	NewRev int             `json:"newRev"`
	Author string          `json:"author"`
}

type Session

type Session struct {
	Author        string
	Auth          *SessionAuth
	Revision      int
	PadId         string
	ReadOnlyPadId string
	ReadOnly      bool
	Time          int64
}

type SessionAuth

type SessionAuth struct {
	PadId     string
	Token     string
	SessionId string
	// IntegratorSessionID is the integrator-set sessionID cookie value
	// (from createSession() HTTP API), read from the socket.io handshake
	// Cookie header so the cookie can be HttpOnly. Falls back to the
	// deprecated CLIENT_READY in-message `sessionID` field for legacy
	// clients. Upstream #7045 / #7755.
	IntegratorSessionID string
}

type SheetOpIncoming added in v0.6.5

type SheetOpIncoming struct {
	Event string `json:"event"`
	Data  struct {
		Component string `json:"component"` // "sheet"
		Type      string `json:"type"`      // "COLLABROOM"
		Data      struct {
			Type    string          `json:"type"` // "SHEET_OP"
			Op      json.RawMessage `json:"op"`   // a sheet.Op
			BaseRev int             `json:"baseRev"`
		} `json:"data"`
	} `json:"data"`
}

SheetOpIncoming is the client->server SHEET_OP message. Wire shape mirrors UserChange: {"event":"message","data":{"component":"sheet","type":"COLLABROOM", "data":{"type":"SHEET_OP","op":<sheet.Op>,"baseRev":N}}}.

type SheetPresence added in v0.6.5

type SheetPresence struct {
	Type string            `json:"type"` // "COLLABROOM"
	Data SheetPresenceData `json:"data"`
}

SheetPresence is the server->clients relay of a cursor / live-edit frame. Sent as ["message", SheetPresence]. Identity is stamped server-side.

type SheetPresenceData added in v0.6.5

type SheetPresenceData struct {
	Type     string `json:"type"` // "SHEET_PRESENCE"
	UserId   string `json:"userId"`
	Name     string `json:"name"`
	Color    string `json:"color"`
	Sheet    string `json:"sheet"`
	Row      int    `json:"row"`
	Col      int    `json:"col"`
	Editing  bool   `json:"editing"`
	Raw      string `json:"raw,omitempty"`
	FocusRow int    `json:"focusRow"`
	FocusCol int    `json:"focusCol"`
}

type SheetPresenceIncoming added in v0.6.5

type SheetPresenceIncoming struct {
	Event string `json:"event"`
	Data  struct {
		Component string `json:"component"` // "sheet"
		Type      string `json:"type"`      // "COLLABROOM"
		Data      struct {
			Type     string `json:"type"` // "SHEET_PRESENCE"
			Sheet    string `json:"sheet"`
			Row      int    `json:"row"`
			Col      int    `json:"col"`
			Editing  bool   `json:"editing"`
			Raw      string `json:"raw"`
			FocusRow int    `json:"focusRow"`
			FocusCol int    `json:"focusCol"`
		} `json:"data"`
	} `json:"data"`
}

SheetPresenceIncoming is the client->server SHEET_PRESENCE frame. Ephemeral: never persisted, never ordered through the per-doc goroutine. Wire shape mirrors SheetOpIncoming: {"event":"message","data":{"component":"sheet", "type":"COLLABROOM","data":{"type":"SHEET_PRESENCE","sheet":..,"row":.., "col":..,"editing":bool,"raw":".."}}}.

type SheetVars added in v0.6.5

type SheetVars struct {
	Type string        `json:"type"` // "SHEET_VARS"
	Data SheetVarsData `json:"data"`
}

SheetVars is the server->client initial state message (the sheet analogue of CLIENT_VARS). Sent as ["message", SheetVars].

type SheetVarsData added in v0.6.5

type SheetVarsData struct {
	Snapshot  json.RawMessage `json:"snapshot"` // a sheet.WorkbookSnapshot
	Head      int             `json:"head"`
	UserId    string          `json:"userId"`
	UserColor string          `json:"userColor"`
	ReadOnly  bool            `json:"readonly"`
}

type UserChange

type UserChange struct {
	Event string         `json:"event"`
	Data  UserChangeData `json:"data"`
}

type UserChangeData added in v0.0.4

type UserChangeData struct {
	Component string             `json:"component"`
	Data      UserChangeDataData `json:"data"`
	Type      string             `json:"type"`
}

type UserChangeDataData added in v0.0.4

type UserChangeDataData struct {
	Type      string                  `json:"type"`
	Apool     UserChangeDataDataApool `json:"apool"`
	BaseRev   int                     `json:"baseRev"`
	Changeset string                  `json:"changeset"`
}

type UserChangeDataDataApool added in v0.0.4

type UserChangeDataDataApool struct {
	NumToAttrib map[int][]string `json:"numToAttrib"`
	NextNum     int              `json:"nextNum"`
}

type UserLeaveData added in v0.0.2

type UserLeaveData struct {
	Type string `json:"type"`
	Data struct {
		Type     string `json:"type"`
		UserInfo struct {
			ColorId string `json:"colorId"`
			UserId  string `json:"userId"`
		} `json:"userInfo"`
	} `json:"data"`
}

type UserNewInfo

type UserNewInfo struct {
	Type string          `json:"type"`
	Data UserNewInfoData `json:"data"`
}

type UserNewInfoDat

type UserNewInfoDat struct {
	UserId  string  `json:"userId"`
	Name    *string `json:"name"`
	ColorId string  `json:"colorId"`
}

type UserNewInfoData

type UserNewInfoData struct {
	Type     string         `json:"type"`
	UserInfo UserNewInfoDat `json:"userInfo"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL