Liking cljdoc? Tell your friends :D

chromex.app.sockets.udp

clj

Use the chrome.sockets.udp API to send and receive data over the network using UDP connections. This API supersedes the UDP functionality previously found in the 'socket' API.

Use the chrome.sockets.udp API to send and receive data over the
network using UDP connections. This API supersedes the UDP functionality
previously found in the 'socket' API.

  * available since Chrome 36
  * https://developer.chrome.com/apps/sockets.udp
raw docstring

api-tableclj

source

bindclj/smacro

(bind socket-id address port)

Binds the local address and port for the socket. For a client socket, it is recommended to use port 0 to let the platform pick a free port.Once the bind operation completes successfully, onReceive events are raised when UDP packets arrive on the address/port specified -- unless the socket is paused.

|socket-id| - The socket ID. |address| - The address of the local machine. DNS name, IPv4 and IPv6 formats are supported. Use '0.0.0.0' to accept packets from all local available network interfaces. |port| - The port of the local machine. Use '0' to bind to a free port.

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.udp#method-bind.

Binds the local address and port for the socket. For a client socket, it is recommended to use port 0 to let the platform
pick a free port.Once the bind operation completes successfully, onReceive events are raised when UDP packets arrive on the
address/port specified -- unless the socket is paused.

  |socket-id| - The socket ID.
  |address| - The address of the local machine. DNS name, IPv4 and IPv6 formats are supported. Use '0.0.0.0' to accept
              packets from all local available network interfaces.
  |port| - The port of the local machine. Use '0' to bind to a free port.

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.udp#method-bind.
sourceraw docstring

bind*cljs

(bind* config socket-id address port)
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 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 ID.

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.udp#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 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 ID.

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.udp#method-close.
sourceraw docstring

close*cljs

(close* config socket-id)
source

createclj/smacro

(create)
(create properties)

Creates a UDP socket with the given properties.

|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.udp#method-create.

Creates a UDP socket with the given properties.

  |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.udp#method-create.
sourceraw docstring

create*cljs

(create* config properties)
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 ID.

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.udp#method-getInfo.

Retrieves the state of the given socket.

  |socket-id| - The socket ID.

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.udp#method-getInfo.
sourceraw docstring

get-info*cljs

(get-info* config socket-id)
source

get-joined-groupsclj/smacro

(get-joined-groups socket-id)

Gets the multicast group addresses the socket is currently joined to.

|socket-id| - The socket ID.

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 [groups] where:

|groups| - Array of groups the socket joined.

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.udp#method-getJoinedGroups.

Gets the multicast group addresses the socket is currently joined to.

  |socket-id| - The socket ID.

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 [groups] where:

  |groups| - Array of groups the socket joined.

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.udp#method-getJoinedGroups.
sourceraw docstring

get-joined-groups*cljs

(get-joined-groups* 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.udp#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.udp#method-getSockets.
sourceraw docstring

get-sockets*cljs

(get-sockets* config)
source

join-groupclj/smacro

(join-group socket-id address)

Joins the multicast group and starts to receive packets from that group. The socket must be bound to a local port before calling this method.

|socket-id| - The socket ID. |address| - The group address to join. Domain names are not supported.

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.udp#method-joinGroup.

Joins the multicast group and starts to receive packets from that group. The socket must be bound to a local port before
calling this method.

  |socket-id| - The socket ID.
  |address| - The group address to join. Domain names are not supported.

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.udp#method-joinGroup.
sourceraw docstring

join-group*cljs

(join-group* config socket-id address)
source

leave-groupclj/smacro

(leave-group socket-id address)

Leaves the multicast group previously joined using joinGroup. This is only necessary to call if you plan to keep using the socketafterwards, since it will be done automatically by the OS when the socket is closed.Leaving the group will prevent the router from sending multicast datagrams to the local host, presuming no other process on the host is still joined to the group.

|socket-id| - The socket ID. |address| - The group address to leave. Domain names are not supported.

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.udp#method-leaveGroup.

Leaves the multicast group previously joined using joinGroup. This is only necessary to call if you plan to keep using the
socketafterwards, since it will be done automatically by the OS when the socket is closed.Leaving the group will prevent
the router from sending multicast datagrams to the local host, presuming no other process on the host is still joined to
the group.

  |socket-id| - The socket ID.
  |address| - The group address to leave. Domain names are not supported.

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.udp#method-leaveGroup.
sourceraw docstring

leave-group*cljs

(leave-group* config socket-id address)
source

on-receive*cljs

(on-receive* config channel & args)
source

on-receive-error*cljs

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

sendclj/smacro

(send socket-id data address port)

Sends data on the given socket to the given address and port. The socket must be bound to a local port before calling this method.

|socket-id| - The socket ID. |data| - The data to send. |address| - The address of the remote machine. |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 [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.udp#method-send.

Sends data on the given socket to the given address and port. The socket must be bound to a local port before calling this
method.

  |socket-id| - The socket ID.
  |data| - The data to send.
  |address| - The address of the remote machine.
  |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 [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.udp#method-send.
sourceraw docstring

send*cljs

(send* config socket-id data address port)
source

set-broadcastclj/smacro

(set-broadcast socket-id enabled)

Enables or disables broadcast packets on this socket.

|socket-id| - The socket ID. |enabled| - true to enable broadcast packets, false to disable them.

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.

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.udp#method-setBroadcast.

Enables or disables broadcast packets on this socket.

  |socket-id| - The socket ID.
  |enabled| - true to enable broadcast packets, false to disable them.

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.

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.udp#method-setBroadcast.
sourceraw docstring

set-broadcast*cljs

(set-broadcast* config socket-id enabled)
source

set-multicast-loopback-modeclj/smacro

(set-multicast-loopback-mode socket-id enabled)

Sets whether multicast packets sent from the host to the multicast group will be looped back to the host.Note: the behavior of setMulticastLoopbackMode is slightly different between Windows and Unix-like systems. The inconsistency happens only when there is more than one application on the same host joined to the same multicast group while having different settings on multicast loopback mode. On Windows, the applications with loopback off will not RECEIVE the loopback packets; while on Unix-like systems, the applications with loopback off will not SEND the loopback packets to other applications on the same host. See MSDN: http://goo.gl/6vqbjCalling this method does not require multicast permissions.

|socket-id| - The socket ID. |enabled| - Indicate whether to enable loopback mode.

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.udp#method-setMulticastLoopbackMode.

Sets whether multicast packets sent from the host to the multicast group will be looped back to the host.Note: the behavior
of setMulticastLoopbackMode is slightly different between Windows and Unix-like systems. The inconsistency happens only
when there is more than one application on the same host joined to the same multicast group while having different settings
on multicast loopback mode. On Windows, the applications with loopback off will not RECEIVE the loopback packets; while on
Unix-like systems, the applications with loopback off will not SEND the loopback packets to other applications on the same
host. See MSDN: http://goo.gl/6vqbjCalling this method does not require multicast permissions.

  |socket-id| - The socket ID.
  |enabled| - Indicate whether to enable loopback mode.

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.udp#method-setMulticastLoopbackMode.
sourceraw docstring

set-multicast-loopback-mode*cljs

(set-multicast-loopback-mode* config socket-id enabled)
source

set-multicast-time-to-liveclj/smacro

(set-multicast-time-to-live socket-id ttl)

Sets the time-to-live of multicast packets sent to the multicast group.Calling this method does not require multicast permissions.

|socket-id| - The socket ID. |ttl| - The time-to-live value.

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.udp#method-setMulticastTimeToLive.

Sets the time-to-live of multicast packets sent to the multicast group.Calling this method does not require multicast
permissions.

  |socket-id| - The socket ID.
  |ttl| - The time-to-live value.

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.udp#method-setMulticastTimeToLive.
sourceraw docstring

set-multicast-time-to-live*cljs

(set-multicast-time-to-live* config socket-id ttl)
source

set-pausedclj/smacro

(set-paused socket-id paused)

Pauses or unpauses a socket. A paused socket is blocked from firing onReceive events.

|socket-id| - https://developer.chrome.com/apps/sockets.udp#property-setPaused-socketId. |paused| - Flag to indicate whether to pause or unpause.

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.udp#method-setPaused.

Pauses or unpauses a socket. A paused socket is blocked from firing onReceive events.

  |socket-id| - https://developer.chrome.com/apps/sockets.udp#property-setPaused-socketId.
  |paused| - Flag to indicate whether to pause or unpause.

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.udp#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.udp namespace.

Taps all valid non-deprecated events in chromex.app.sockets.udp 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 paused and no more onReceive events will be raised for this socket until the socket is resumed.

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.udp#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 paused and no more onReceive events will be raised for this socket until the socket is
resumed.

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.udp#event-onReceiveError.
sourceraw docstring

tap-on-receive-eventsclj/smacro

(tap-on-receive-events channel & args)

Event raised when a UDP packet has been received for the 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.udp#event-onReceive.

Event raised when a UDP packet has been received for the 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.udp#event-onReceive.
sourceraw docstring

updateclj/smacro

(update socket-id properties)

Updates the socket properties.

|socket-id| - The socket ID. |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.udp#method-update.

Updates the socket properties.

  |socket-id| - The socket ID.
  |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.udp#method-update.
sourceraw docstring

update*cljs

(update* config socket-id properties)
source

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

× close