SockJSSocket

You interact with SockJS clients through instances of SockJS socket.

The API is very similar to @see \io\vertx\jphp\core\http\WebSocket. It implements both and so it can be used with

see

to pump data with flow control.

package

Default

Methods

__construct

__construct() 

Close it

close( $arg0 = null,  $arg1 = null) : void

close()

Close it giving a status code and reason. Only Applicable to RawWebSocket will downgrade to plain close for other transports.

param $statusCode [integer] param $reason [string] close($statusCode, $reason)

Arguments

$arg0

integer

$arg1

string

drainHandler

drainHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

Call @see \io\vertx\jphp\ext\web\handler\sockjs\SockJSSocket::end.

end( $arg0 = null) : void

end()

Same as @see \io\vertx\jphp\ext\web\handler\sockjs\SockJSSocket::end but writes some data to the stream before ending.

param $t [Buffer] end($t)

Arguments

$arg0

Buffer

endHandler

endHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

exceptionHandler

exceptionHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

Fetch the specified <code>amount</code> of elements. If the <code>ReadStream</code> has been paused, reading will recommence with the specified <code>amount</code> of items, otherwise the specified <code>amount</code> will be added to the current stream demand.

fetch( $arg0) : $this

Arguments

$arg0

integer

Response

$this

a reference to this, so the API can be used fluently

handler

handler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

Return the headers corresponding to the last request for this socket or the websocket handshake Any cookie headers will be removed for security reasons

headers() : \io\vertx\jphp\core\MultiMap

Return the local address for this socket

localAddress() : \io\vertx\jphp\core\net\SocketAddress

pause

pause() : $this

Response

$this

Return the remote address for this socket

remoteAddress() : \io\vertx\jphp\core\net\SocketAddress

resume

resume() : $this

Response

$this

setWriteQueueMaxSize

setWriteQueueMaxSize( $arg0) : $this

Arguments

$arg0

integer

Response

$this

Return the URI corresponding to the last request for this socket or the websocket handshake

uri() : string

Response

string

webSession

webSession() : \io\vertx\jphp\ext\web\Session

Response

\io\vertx\jphp\ext\web\Session

the Vert.x-Web session corresponding to this socket

webUser

webUser() : \io\vertx\jphp\ext\auth\User

Response

\io\vertx\jphp\ext\auth\User

the Vert.x-Web user corresponding to this socket

param $data [Buffer] <b> write($data) </b>

write( $arg0) : $this

Write a \java.lang.String to the socket, encoded in UTF-8.

param $data [string] the string to write write($data)

Arguments

$arg0

Buffer | string

Response

$this

When a <code>SockJSSocket</code> is created it automatically registers an event handler with the event bus, the ID of that handler is given by <code>writeHandlerID</code>.

writeHandlerID() : string

Given this ID, a different event loop can send a buffer to that event handler using the event bus and that buffer will be received by this instance in its own event loop and written to the underlying socket. This allows you to write data to other sockets which are owned by different event loops.

Response

string

This will return <code>true</code> if there are more bytes in the write queue than the value set using @see \io\vertx\jphp\ext\web\handler\sockjs\SockJSSocket::setWriteQueueMaxSize

writeQueueFull() : boolean

Response

boolean

true if write queue is full