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 |
__construct()
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)
integer
string
drainHandler( $arg0) : $this
callable
$this
end( $arg0, $arg1 = null) : void
param $handler [callable] end($handler)
Same as but with an handler
called when the operation completes
param $data [Buffer] param $handler [callable] end($data, $handler)
Buffer | callable
callable
endHandler( $arg0) : $this
callable
$this
exceptionHandler( $arg0) : $this
callable
$this
fetch( $arg0) : $this
integer
$this
a reference to this, so the API can be used fluently
handler( $arg0) : $this
callable
$this
headers() : \io\vertx\jphp\core\MultiMap
localAddress() : \io\vertx\jphp\core\net\SocketAddress
pause() : $this
$this
pipe() : \io\vertx\jphp\ext\web\handler\sockjs\Pipe<Buffer>
The stream will be resumed when the pipe will be wired to a WriteStream
.
\io\vertx\jphp\ext\web\handler\sockjs\Pipe
a pipe
pipeTo( $arg0, $arg1) : void
Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the handler
will be
called with the result.
WriteStream
callable
remoteAddress() : \io\vertx\jphp\core\net\SocketAddress
resume() : $this
$this
setWriteQueueMaxSize( $arg0) : $this
integer
$this
uri() : string
string
webSession() : \io\vertx\jphp\ext\web\Session
webUser() : \io\vertx\jphp\ext\auth\User
write( $arg0, $arg1 = null) : void
param $data [string] the string to write write($data)
param $data [string] param $handler [callable] write($data, $handler)
param $data [Buffer] param $handler [callable] write($data, $handler)
Buffer | string
callable
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.
string
writeQueueFull() : boolean
boolean
true if write queue is full