Skip to content

@my-swu/simulator-client


@my-swu/simulator-client / chatMessage

Function: chatMessage() ​

chatMessage(message): ClientMessage

Defined in: packages/ts-sdk/src/messages.ts:134

Builds one in-match chat socket message.

The server trims and caps the message before broadcasting it as a match-history entry.

Example:

ts
import { chatMessage } from '@my-swu/simulator-client'

// Chat frames are broadcast to every seat and spectator in the match.
const clientMessage = chatMessage('good luck')

console.log(clientMessage.type)

Parameters ​

message ​

Example:

ts
import { chatMessage } from '@my-swu/simulator-client'

// Chat frames are broadcast to every seat and spectator in the match.
const clientMessage = chatMessage('good luck')

console.log(clientMessage.type)

string

Returns ​

ClientMessage

Example ​

ts
import { chatMessage } from '@my-swu/simulator-client'

const clientMessage = chatMessage('ready?')
console.log(clientMessage.type)

See ​

https://simulator-sdk.my-swu.com/guide/websocket

Released under the MIT License.