| // Copyright 2015 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| [DartPackage="mojo_services"] |
| module mojo; |
| |
| import "mojo/public/interfaces/network/network_error.mojom"; |
| import "network/interfaces/http_message.mojom"; |
| import "network/interfaces/web_socket.mojom"; |
| |
| interface HttpConnection { |
| // Sets the OS send buffer size (in bytes) for the underlying socket. |
| SetSendBufferSize(uint32 size) => (NetworkError result); |
| |
| // Sets the OS receive buffer size (in bytes) for the underlying socket. |
| SetReceiveBufferSize(uint32 size) => (NetworkError result); |
| }; |
| |
| interface HttpConnectionDelegate { |
| // Called when an HTTP request is received. |
| OnReceivedRequest(HttpRequest request) => (HttpResponse response); |
| |
| // Called when an WebSocket request is received. |
| // |
| // If the delegate decides to accept the request, it should respond with |
| // non-null arguments in the callback. |send_stream| is a data pipe which |
| // should remain open for the lifetime of the WebSocket. Data to send over the |
| // WebSocket should be written to the producer end of the |send_stream|. |
| // |web_socket| will be already connected. There is no need to call Connect() |
| // on it. But |client| will still receive a DidConnect() notification. |
| // |
| // NOTE: WebSocket server support is not fully implemented. For now the |
| // following are not supported: |
| // - negotiating subprotocol or extension; |
| // - fragmented or non-text messages; |
| // - failure or close notification; |
| // - flow control. |
| OnReceivedWebSocketRequest(HttpRequest request) |
| => (WebSocket&? web_socket, |
| handle<data_pipe_consumer>? send_stream, |
| WebSocketClient? client); |
| }; |