OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 import "mojo/services/public/interfaces/network/network_error.mojom" |
| 6 |
| 7 module mojo { |
| 8 |
| 9 interface WebSocket { |
| 10 enum MessageType { |
| 11 CONTINUATION, |
| 12 TEXT, |
| 13 BINARY |
| 14 }; |
| 15 const int16 kAbnormalCloseCode = 1006; // stolen from websocket_bridge |
| 16 |
| 17 Connect( |
| 18 string url, string[] protocols, string origin, WebSocketClient client); |
| 19 Send(bool fin, MessageType type, handle<data_pipe_consumer> data); |
| 20 FlowControl(int64 quota); |
| 21 Close(int16 code, string reason); |
| 22 }; |
| 23 |
| 24 interface WebSocketClient { |
| 25 DidConnect(bool fail, string selected_subprotocol, string extensions); |
| 26 DidReceiveData( |
| 27 bool fin, WebSocket.MessageType type, handle<data_pipe_consumer> data); |
| 28 DidReceiveFlowControl(int64 quota); |
| 29 |
| 30 // TODO(mpcomplete): add these methods from blink: |
| 31 // void didStartOpeningHandshake(WebSocketHandle*, const |
| 32 // WebSocketHandshakeRequestInfo&) = 0; |
| 33 // |
| 34 // void didFinishOpeningHandshake(WebSocketHandle*, const |
| 35 // WebSocketHandshakeResponseInfo&) = 0; |
| 36 // |
| 37 // void didFail(WebSocketHandle* /* handle */, const WebString& |
| 38 // message) = 0; |
| 39 // |
| 40 // void didClose(WebSocketHandle* /* handle */, bool wasClean, |
| 41 // unsigned short code, const WebString& reason) = 0; |
| 42 // |
| 43 // void didStartClosingHandshake(WebSocketHandle*) = 0; |
| 44 }; |
| 45 |
| 46 } |
OLD | NEW |