Module vibe.http.websockets
Implements WebSocket
support and fallbacks for older browsers.
Example
void handleConn(scope WebSocket sock)
{
// simple echo server
while (sock .connected) {
auto msg = sock .receiveText();
sock .send(msg);
}
}
void startServer()
{
import vibe .http .router;
auto router = new URLRouter;
router .get("/ws", handleWebSockets(&handleConn));
// Start HTTP server using listenHTTP()...
}
Functions
Name | Description |
---|---|
connectWebSocket
|
Returns a WebSocket client object that is connected to the specified host.
|
handleWebSocket
|
Establishes a web socket conection and passes it to the on_handshake delegate.
|
handleWebSockets
|
Returns a HTTP request handler that establishes web socket conections. |
Classes
Name | Description |
---|---|
IncomingWebSocketMessage
|
Represents a single incoming WebSocket message as an InputStream. |
OutgoingWebSocketMessage
|
Represents a single outgoing WebSocket message as an OutputStream. |
WebSocket
|
Represents a single WebSocket connection. |
WebSocketException
|
Exception thrown by vibe .
|
Structs
Name | Description |
---|---|
Frame
|
Enums
Name | Description |
---|---|
FrameOpcode
|
Aliases
Name | Type | Description |
---|---|---|
WebSocketHandshakeDelegate
|
void delegate(scope WebSocket)
|
Authors
Jan Krüger
Copyright
© 2012-2014 RejectedSoftware e.K.
License
Subject to the terms of the MIT license, as written in the included LICENSE.txt file.