Use the chrome.sockets.tcp API to send and receive data over the network using TCP connections. This API supersedes the TCP functionality previously found in the chrome.socket API.
Use the chrome.sockets.tcp API to send and receive data over the network using TCP connections. This API supersedes the TCP functionality previously found in the chrome.socket API. * available since Chrome 34 * https://developer.chrome.com/apps/sockets.tcp
(close socket-id)
Closes the socket and releases the address/port the socket is bound to. Each socket created should be closed after use. The socket id is no no longer valid as soon at the function is called. However, the socket is guaranteed to be closed only when the callback is invoked.
|socket-id| - The socket identifier.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
Closes the socket and releases the address/port the socket is bound to. Each socket created should be closed after use. The socket id is no no longer valid as soon at the function is called. However, the socket is guaranteed to be closed only when the callback is invoked. |socket-id| - The socket identifier. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is []. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/sockets.tcp#method-close.
(connect socket-id peer-address peer-port)
Connects the socket to a remote machine. When the connect operation completes successfully, onReceive events are raised when data is received from the peer. If a network error occurs while the runtime is receiving packets, a onReceiveError event is raised, at which point no more onReceive event will be raised for this socket until the resume method is called.
|socket-id| - The socket identifier. |peer-address| - The address of the remote machine. DNS name, IPv4 and IPv6 formats are supported. |peer-port| - The port of the remote machine.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [result] where:
|result| - The result code returned from the underlying network call. A negative value indicates an error.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/sockets.tcp#method-connect.
Connects the socket to a remote machine. When the connect operation completes successfully, onReceive events are raised when data is received from the peer. If a network error occurs while the runtime is receiving packets, a onReceiveError event is raised, at which point no more onReceive event will be raised for this socket until the resume method is called. |socket-id| - The socket identifier. |peer-address| - The address of the remote machine. DNS name, IPv4 and IPv6 formats are supported. |peer-port| - The port of the remote machine. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [result] where: |result| - The result code returned from the underlying network call. A negative value indicates an error. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/sockets.tcp#method-connect.
(create)
(create properties)
Creates a TCP socket.
|properties| - The socket properties (optional).
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [create-info] where:
|create-info| - The result of the socket creation.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/sockets.tcp#method-create.
Creates a TCP socket. |properties| - The socket properties (optional). This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [create-info] where: |create-info| - The result of the socket creation. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/sockets.tcp#method-create.
(disconnect socket-id)
Disconnects the socket.
|socket-id| - The socket identifier.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/sockets.tcp#method-disconnect.
Disconnects the socket. |socket-id| - The socket identifier. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is []. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/sockets.tcp#method-disconnect.
(get-info socket-id)
Retrieves the state of the given socket.
|socket-id| - The socket identifier.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [socket-info] where:
|socket-info| - Object containing the socket information.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/sockets.tcp#method-getInfo.
Retrieves the state of the given socket. |socket-id| - The socket identifier. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [socket-info] where: |socket-info| - Object containing the socket information. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/sockets.tcp#method-getInfo.
(get-sockets)
Retrieves the list of currently opened sockets owned by the application.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [socket-infos] where:
|socket-infos| - Array of object containing socket information.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/sockets.tcp#method-getSockets.
Retrieves the list of currently opened sockets owned by the application. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [socket-infos] where: |socket-infos| - Array of object containing socket information. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/sockets.tcp#method-getSockets.
(secure socket-id)
(secure socket-id options)
Start a TLS client connection over the connected TCP client socket.
|socket-id| - The existing, connected socket to use. |options| - Constraints and parameters for the TLS connection.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [result] where:
|result| - https://developer.chrome.com/apps/sockets.tcp#property-callback-result.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/sockets.tcp#method-secure.
Start a TLS client connection over the connected TCP client socket. |socket-id| - The existing, connected socket to use. |options| - Constraints and parameters for the TLS connection. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [result] where: |result| - https://developer.chrome.com/apps/sockets.tcp#property-callback-result. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/sockets.tcp#method-secure.
(send socket-id data)
Sends data on the given TCP socket.
|socket-id| - The socket identifier. |data| - The data to send.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [send-info] where:
|send-info| - Result of the send method.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
Sends data on the given TCP socket. |socket-id| - The socket identifier. |data| - The data to send. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [send-info] where: |send-info| - Result of the send method. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/sockets.tcp#method-send.
(set-keep-alive socket-id enable)
(set-keep-alive socket-id enable delay)
Enables or disables the keep-alive functionality for a TCP connection.
|socket-id| - The socket identifier. |enable| - If true, enable keep-alive functionality. |delay| - Set the delay seconds between the last data packet received and the first keepalive probe. Default is 0.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [result] where:
|result| - The result code returned from the underlying network call. A negative value indicates an error.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/sockets.tcp#method-setKeepAlive.
Enables or disables the keep-alive functionality for a TCP connection. |socket-id| - The socket identifier. |enable| - If true, enable keep-alive functionality. |delay| - Set the delay seconds between the last data packet received and the first keepalive probe. Default is 0. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [result] where: |result| - The result code returned from the underlying network call. A negative value indicates an error. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/sockets.tcp#method-setKeepAlive.
(set-no-delay socket-id no-delay)
Sets or clears TCP_NODELAY for a TCP connection. Nagle's algorithm will be disabled when TCP_NODELAY is set.
|socket-id| - The socket identifier. |no-delay| - If true, disables Nagle's algorithm.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [result] where:
|result| - The result code returned from the underlying network call. A negative value indicates an error.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/sockets.tcp#method-setNoDelay.
Sets or clears TCP_NODELAY for a TCP connection. Nagle's algorithm will be disabled when TCP_NODELAY is set. |socket-id| - The socket identifier. |no-delay| - If true, disables Nagle's algorithm. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [result] where: |result| - The result code returned from the underlying network call. A negative value indicates an error. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/sockets.tcp#method-setNoDelay.
(set-paused socket-id paused)
Enables or disables the application from receiving messages from its peer. The default value is 'false'. Pausing a socket is typically used by an application to throttle data sent by its peer. When a socket is paused, no onReceive event is raised. When a socket is connected and un-paused, onReceive events are raised again when messages are received.
|socket-id| - https://developer.chrome.com/apps/sockets.tcp#property-setPaused-socketId. |paused| - https://developer.chrome.com/apps/sockets.tcp#property-setPaused-paused.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/sockets.tcp#method-setPaused.
Enables or disables the application from receiving messages from its peer. The default value is 'false'. Pausing a socket is typically used by an application to throttle data sent by its peer. When a socket is paused, no onReceive event is raised. When a socket is connected and un-paused, onReceive events are raised again when messages are received. |socket-id| - https://developer.chrome.com/apps/sockets.tcp#property-setPaused-socketId. |paused| - https://developer.chrome.com/apps/sockets.tcp#property-setPaused-paused. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is []. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/sockets.tcp#method-setPaused.
(tap-all-events chan)
Taps all valid non-deprecated events in chromex.app.sockets.tcp namespace.
Taps all valid non-deprecated events in chromex.app.sockets.tcp namespace.
(tap-on-receive-error-events channel & args)
Event raised when a network error occured while the runtime was waiting for data on the socket address and port. Once this event is raised, the socket is set to paused and no more onReceive events are raised for this socket.
Events will be put on the |channel| with signature [::on-receive-error [info]] where:
|info| - The event data.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/sockets.tcp#event-onReceiveError.
Event raised when a network error occured while the runtime was waiting for data on the socket address and port. Once this event is raised, the socket is set to paused and no more onReceive events are raised for this socket. Events will be put on the |channel| with signature [::on-receive-error [info]] where: |info| - The event data. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/sockets.tcp#event-onReceiveError.
(tap-on-receive-events channel & args)
Event raised when data has been received for a given socket.
Events will be put on the |channel| with signature [::on-receive [info]] where:
|info| - The event data.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/sockets.tcp#event-onReceive.
Event raised when data has been received for a given socket. Events will be put on the |channel| with signature [::on-receive [info]] where: |info| - The event data. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/sockets.tcp#event-onReceive.
(update socket-id properties)
Updates the socket properties.
|socket-id| - The socket identifier. |properties| - The properties to update.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/sockets.tcp#method-update.
Updates the socket properties. |socket-id| - The socket identifier. |properties| - The properties to update. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is []. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/sockets.tcp#method-update.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close