wwWebSocket::BroadcastMessage

This method allows you to broadcast a message to connected Web Socket clients at the server you are targeting.

The loMsg object can either be:

  • An incoming loSocket.oMessage object in wwProcess::OnWebSocket(loSocket)
  • A standalone message for sending in desktop application

In either scenario you can customize the loMsg instance as needed

Example:

DO wwWebSockets
loSocket = CREATEOBJECT("wwWebSockets")
loSocket.cBaseUrl = "http://localhost:5200/"
loMsg = loSocket.CreateMessageObject()

loMsg.userId = "RickFox"
loMsg.message = "Hello from FoxPro " + TIME()
loMsg.action = "broadcastchatmessage"  && send to everybody
loSocket.BroadcastMessage(loMsg)
o.BroadcastMessage(loMsg)

Parameters

loMsg
A message object created with CreateMessageObject() or passed in from a Web Socket request in Web Connection.


See also:

Class wwWebSocket

© West Wind Technologies, 1996-2024 • Updated: 03/15/21
Comment or report problem with topic