| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Use the <code>chrome.sockets.tcpServer</code> API to create server | 5 // Use the <code>chrome.sockets.tcpServer</code> API to create server |
| 6 // applications using TCP connections. This API supersedes the TCP functionality | 6 // applications using TCP connections. This API supersedes the TCP functionality |
| 7 // previously found in the <code>chrome.socket</code> API. Note that the socket | 7 // previously found in the <code>chrome.socket</code> API. |
| 8 // ids created from this namespace are not compatible with ids created in other | |
| 9 // namespaces. | |
| 10 namespace sockets.tcpServer { | 8 namespace sockets.tcpServer { |
| 11 // The socket properties specified in the <code>create</code> or | 9 // The socket properties specified in the <code>create</code> or |
| 12 // <code>update</code> function. Each property is optional. If a property | 10 // <code>update</code> function. Each property is optional. If a property |
| 13 // value is not specified, a default value is used when calling | 11 // value is not specified, a default value is used when calling |
| 14 // <code>create</code>, or the existing value if preserved when calling | 12 // <code>create</code>, or the existing value if preserved when calling |
| 15 // <code>update</code>. | 13 // <code>update</code>. |
| 16 dictionary SocketProperties { | 14 dictionary SocketProperties { |
| 17 // Flag indicating if the socket remains open when the event page of the | 15 // Flag indicating if the socket remains open when the event page of the |
| 18 // application is unloaded (see | 16 // application is unloaded (see |
| 19 // <a href="http://developer.chrome.com/apps/app_lifecycle.html">Manage App | 17 // <a href="http://developer.chrome.com/apps/app_lifecycle.html">Manage App |
| 20 // Lifecycle</a>). The default value is "false." When the application is | 18 // Lifecycle</a>). The default value is "false." When the application is |
| 21 // loaded, any sockets previously opened with persistent=true can be fetched | 19 // loaded, any sockets previously opened with persistent=true can be fetched |
| 22 // with <code>getSockets</code>. | 20 // with <code>getSockets</code>. |
| 23 boolean? persistent; | 21 boolean? persistent; |
| 24 | 22 |
| 25 // An application-defined string associated with the socket. | 23 // An application-defined string associated with the socket. |
| 26 DOMString? name; | 24 DOMString? name; |
| 27 }; | 25 }; |
| 28 | 26 |
| 29 // Result of <code>create</code> call. | 27 // Result of <code>create</code> call. |
| 30 dictionary CreateInfo { | 28 dictionary CreateInfo { |
| 31 // The ID of the newly created server socket. | 29 // The ID of the newly created server socket. Note that socket IDs created |
| 30 // from this API are not compatible with socket IDs created from other APIs, |
| 31 // such as the deprecated <code>$ref:socket</code> API. |
| 32 long socketId; | 32 long socketId; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 // Callback from the <code>create</code> method. | 35 // Callback from the <code>create</code> method. |
| 36 // |createInfo| : The result of the socket creation. | 36 // |createInfo| : The result of the socket creation. |
| 37 callback CreateCallback = void (CreateInfo createInfo); | 37 callback CreateCallback = void (CreateInfo createInfo); |
| 38 | 38 |
| 39 // Callback from the <code>listen</code> method. | 39 // Callback from the <code>listen</code> method. |
| 40 // |result| : The result code returned from the underlying network call. | 40 // |result| : The result code returned from the underlying network call. |
| 41 // A negative value indicates an error. | 41 // A negative value indicates an error. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 // Event raised when a network error occured while the runtime was waiting | 185 // Event raised when a network error occured while the runtime was waiting |
| 186 // for new connections on the socket address and port. Once this event is | 186 // for new connections on the socket address and port. Once this event is |
| 187 // raised, the socket is set to <code>paused</code> and no more | 187 // raised, the socket is set to <code>paused</code> and no more |
| 188 // <code>onAccept</code> events are raised for this socket until the socket | 188 // <code>onAccept</code> events are raised for this socket until the socket |
| 189 // is resumed. | 189 // is resumed. |
| 190 // |info| : The event data. | 190 // |info| : The event data. |
| 191 static void onAcceptError(AcceptErrorInfo info); | 191 static void onAcceptError(AcceptErrorInfo info); |
| 192 }; | 192 }; |
| 193 }; | 193 }; |
| OLD | NEW |