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: (

public class WebSocketMessageQueue

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.

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);

// 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