Liking cljdoc? Tell your friends :D

chromex.app.sockets.tcp

clj

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 33
  * https://developer.chrome.com/apps/sockets.tcp
raw docstring

api-tableclj

source

closeclj/smacro

(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.

https://developer.chrome.com/apps/sockets.tcp#method-close.

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.
sourceraw docstring

close*cljs

(close* config socket-id)
source

connectclj/smacro

(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.
sourceraw docstring

connect*cljs

(connect* config socket-id peer-address peer-port)
source

createclj/smacro

(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.
sourceraw docstring

create*cljs

(create* config properties)
source

disconnectclj/smacro

(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.
sourceraw docstring

disconnect*cljs

(disconnect* config socket-id)
source

gen-callclj

source

gen-wrapclj/smacro

(gen-wrap kind item-id config & args)
source

get-infoclj/smacro

(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.
sourceraw docstring

get-info*cljs

(get-info* config socket-id)
source

get-socketsclj/smacro

(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.
sourceraw docstring

get-sockets*cljs

(get-sockets* config)
source

on-receive*cljs

(on-receive* config channel & args)
source

on-receive-error*cljs

(on-receive-error* config channel & args)
source

secureclj/smacro

(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.
sourceraw docstring

secure*cljs

(secure* config socket-id options)
source

sendclj/smacro

(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.

https://developer.chrome.com/apps/sockets.tcp#method-send.

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.
sourceraw docstring

send*cljs

(send* config socket-id data)
source

set-keep-aliveclj/smacro

(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.
sourceraw docstring

set-keep-alive*cljs

(set-keep-alive* config socket-id enable delay)
source

set-no-delayclj/smacro

(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.
sourceraw docstring

set-no-delay*cljs

(set-no-delay* config socket-id no-delay)
source

set-pausedclj/smacro

(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.
sourceraw docstring

set-paused*cljs

(set-paused* config socket-id paused)
source

tap-all-eventsclj/smacro

(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.
sourceraw docstring

tap-on-receive-error-eventsclj/smacro

(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.
sourceraw docstring

tap-on-receive-eventsclj/smacro

(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.
sourceraw docstring

updateclj/smacro

(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.
sourceraw docstring

update*cljs

(update* config socket-id properties)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close