WebSocketMessageQueue ClassC# API
Provides a mechanism for waiting for WebSocketMessage's to arrive from the server.
Inheritance Hierarchy

System Object
  Facilita.Web WebSocketMessageQueue

Namespace: Facilita.Web
Assembly: clrWebBrowser (in clrWebBrowser.dll) Version: 9.5.7.98 (1.0.0.0)
Syntax

public class WebSocketMessageQueue
Remarks

As soon as a WebSocket is opened, the server can start sending messages to the client. It is often necessary to wait for a particular message to arrive from the server before the script can continue. This class provides an easy way to wait for a message to arrive.
Examples

The following example demonstrates waiting for a message to arrive from the server.
Url url = new Url("ws://somecompany.com/");
WebSocket webSocket = WebBrowser.CreateWebSocket(url, 1);
webSocket.Open();

// Create a message queue
WebSocketMessageQueue messageQueue = new WebSocketMessageQueue(webSocket);

// Wait for the "ready" message to arrive from the server, waiting up to 30 seconds between messages.
WebSocketMessage message = messageQueue.WaitForMessageContaining("ready", TimeSpan.FromSeconds(30));
See Also