Skip to content

WebSocket Message

  • Trigger
  • Web
  • Advanced mode

Starts the macro when a WebSocket server sends a message, or when the connection opens or drops, e.g. Streamer.bot's or Home Assistant's live events. MacroWin stays connected while the macro is enabled, shares one connection per address and sign-in, and reconnects by itself. Text messages up to 1 MB.

In the editor, press Space on the canvas to add a step, then open Triggers > Web, or type its name. In Simple mode it's under Show all, and search finds it.

Settings

URL

A web address Required

The server's WebSocket address, e.g. ws://192.168.1.20:8080/ or wss://example.com/socket. An address that holds a token belongs in Password mode.

Starts as: empty

Event

A choice
  • A message arrives
  • Connected: Each time the connection opens, also after a reconnect.
  • Disconnected: Each time the connection drops.

Starts as: A message arrives

Only messages containing

Text

Only a message holding this text starts the macro. Empty: every message.

Starts as: empty

Send after connecting

Text

Text sent after every connect, for services that need a subscribe message. Sent as typed.

Starts as: empty

Authorization

Text

Sent as the Authorization header, e.g. Bearer and the token. Stored as a password.

Starts as: empty Starts as a password

Headers

Text More options

One per line, e.g. Origin: https://example.com

Starts as: empty

Keep alive every (s)

A whole number

A ping so a quiet connection isn't closed in between.

Starts as: 30

Outputs

Values the step gives to the steps after it. In the Graph view, drag a wire from an output to another step's field.

WebSocket Message outputs
OutputGivesWhat it is
MessageTextThe message's text; empty for Connected and Disconnected.

Good to know

  • Wait for Event can wait for it in the middle of a macro, with the same settings.
  • Fields marked as passwords keep their value in the Windows password vault, never in the macro.

More in Web