Web-sockets Server Actions

Description

Performs an action on the web-socket server, such as 'Send a message to the web-sockets server'. The message will be received by all UX and Grid components that are listening for web-socket messages and the 'webSocketOnMessage client-side event in all listening components will fire.

Used with the Grid and UX components

Web-sockets Server Action Properties

Action name

Specify the web-socket server action to execute.

Send Message Properties

Method for creating message text

You can enter the text for the message now, or you can execute Javascript code at run-time that returns the message text. Choices include Text, Javascript.

Message

Specify the message. You can either enter a string of text or you can specify a Javascript function by entering: javascript:name_of_your_function

Message type

Specify the message type. There are certain 'built-in' message types that Alpha Anywhere supports (such as 'messageboard'). If you just want to send a simple text message (not one of the built-in types) select the 'Simple' option. To define your own built-in message types, you need to add a new .js file to the 'node_services\ws_queue' folder in the Alpha Anywhere executable folder. If you want to call a Javascript function to specify the message type enter: javascript:yourfunctionname

Javascript for message

Specify the Javascript to run to get the message text. Your Javascript must include the 'return' command to return the text to use in the message. For example: return messageText;

Start Web-socket Server Properties

Start listening once server is started

Should the client start listening for messages once the web-socket server has been started?

Message subscriptions

Specify if you want to subscribe to all messages, or to a subset of the messages broadcast by the web-socket server. If you leave this blank then you will be subscribed to the list of message types defined in the component. Enter a comma delimited list of message types, or to specify the types using Javascript, enter javascript:yourfunctionname.

Server-side Send Message Properties

Xbasic function to generate message

Specify the name of the Xbasic function to call to generate the message. This message will then be broadcast to all of the connected clients.

Message Subscriptions Properties

Message subscriptions

Specify if you want to subscribe to all messages, or to a subset of the messages broadcast by the web-socket server. If you leave this blank then you will be subscribed to the list of message types defined in the component. Enter a comma delimited list of message types, or to specify the types using Javascript, enter javascript:yourfunctionname.

See Also