Documentation
ΒΆ
Index ΒΆ
- type Client
- func (c *Client) CloseSendChannel()
- func (c *Client) GetClientID() string
- func (c *Client) GetConnectedAt() time.Time
- func (c *Client) GetID() string
- func (c *Client) GetUsername() string
- func (c *Client) ReadPump()
- func (c *Client) SendMessage(msg messages.BaseMessage)
- func (c *Client) StartConnectionTimer()
- func (c *Client) WritePump()
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
This section is empty.
Types ΒΆ
type Client ΒΆ
type Client struct { Username string Conn *websocket.Conn Send chan messages.BaseMessage Hub interfaces.HubInterface Sub string // Keycloak stable user ID ClientID string // OAuth client ID, e.g., "ChatClient" or "WebClient" ConnectedAt time.Time }
Client represents a single WebSocket connection from a user. It manages receiving and sending messages to/from the server.
func (*Client) CloseSendChannel ΒΆ
func (c *Client) CloseSendChannel()
CloseSendChannel closes the client's outgoing message channel.
func (*Client) GetClientID ΒΆ
GetClientID returns the OAuth client ID used to identify the source application.
func (*Client) GetConnectedAt ΒΆ
GetConnectedAt returns the timestamp when the client connected.
func (*Client) GetUsername ΒΆ
GetUsername returns the client's username.
func (*Client) ReadPump ΒΆ
func (c *Client) ReadPump()
ReadPump listens for incoming messages from the WebSocket and processes them. Parsed messages are sent to the hub for broadcast or private delivery.
func (*Client) SendMessage ΒΆ
func (c *Client) SendMessage(msg messages.BaseMessage)
SendMessage places a message into the send channel to be picked up by WritePump().
func (*Client) StartConnectionTimer ΒΆ
func (c *Client) StartConnectionTimer()
StartConnectionTimer records the time when the client connects.