Represents a server side WebSocket.
Instances of this class are passed into a @see \io\vertx\jphp\core\http\HttpServer::websocketHandler or provided when a WebSocket handshake is manually @see \io\vertx\jphp\core\http\HttpServerRequest::upgradeed.
package |
Default |
---|
__construct()
accept() : void
This method should be called from the websocket handler to explicitely accept the websocker and terminate the WebSocket handshake.
binaryHandlerID() : string
Given this ID, a different event loop can send a binary frame 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 connection. This allows you to write data to other WebSockets which are owned by different event loops.
string
the binary handler id
binaryMessageHandler( $arg0) : $this
callable
$this
a reference to this, so the API can be used fluently
close( $arg0 = null, $arg1 = null) : void
No more messages can be sent.
close()
param $statusCode [integer] close($statusCode)
param $statusCode [integer] param $reason [string] close($statusCode, $reason)
integer
string
closeHandler( $arg0) : $this
callable
$this
drainHandler( $arg0) : $this
callable
$this
end( $arg0 = null) : void
end()
Same as @see \io\vertx\jphp\core\http\WebSocketBase::end but writes some data to the stream before ending.
param $t [Buffer] end($t)
Buffer
endHandler( $arg0) : $this
callable
$this
exceptionHandler( $arg0) : $this
callable
$this
fetch( $arg0) : $this
integer
$this
frameHandler( $arg0) : $this
callable
$this
handler( $arg0) : $this
callable
$this
headers() : \io\vertx\jphp\core\MultiMap
isSsl() : boolean
boolean
true if this {@link io.vertx.core.http.HttpConnection} is encrypted via SSL/TLS.
localAddress() : \io\vertx\jphp\core\net\SocketAddress
path() : string
string
the WebSocket handshake path.
pause() : $this
$this
pongHandler( $arg0) : $this
Pong frames may be at most 125 bytes (octets).
There is no ping handler since pings should immediately be responded to with a pong with identical content
Pong frames may be received unsolicited.
callable
$this
a reference to this, so the API can be used fluently
query() : string
string
the WebSocket handshake query string.
reject( $arg0 = null) : void
Calling this method from the websocket handler when it is first passed to you gives you the opportunity to reject the websocket, which will cause the websocket handshake to fail by returning a response code.
You might use this method, if for example you only want to accept WebSockets with a particular path.
reject()
Like @see \io\vertx\jphp\core\http\ServerWebSocket::reject but with a status
.
param $status [integer]
reject($status)
integer
remoteAddress() : \io\vertx\jphp\core\net\SocketAddress
resume() : $this
$this
setWriteQueueMaxSize( $arg0) : $this
integer
$this
subProtocol() : string
On the server, the value will be null
when the handler receives the websocket callback as the
handshake will not be completed yet.
string
textHandlerID() : string
Given this ID, a different event loop can send a text frame 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 connection. This allows you to write data to other WebSockets which are owned by different event loops.
string
textMessageHandler( $arg0) : $this
callable
$this
a reference to this, so the API can be used fluently
uri() : string
string
write( $arg0) : $this
Buffer
$this
writeBinaryMessage( $arg0) : $this
Buffer
$this
writeFinalBinaryFrame( $arg0) : $this
Buffer
$this
writeFinalTextFrame( $arg0) : $this
string
$this
writeFrame( $arg0) : $this
WebSocketFrame
$this
writePing( $arg0) : $this
This method should not be used to write application data and should only be used for implementing a keep alive or to ensure the client is still responsive, see RFC 6455 Section 5.5.2.
There is no pingHandler because RFC 6455 section 5.5.2 clearly states that the only response to a ping is a pong with identical contents.
Buffer
$this
a reference to this, so the API can be used fluently
writePong( $arg0) : $this
This method should not be used to write application data and should only be used for implementing a keep alive or to ensure the client is still responsive, see RFC 6455 Section 5.5.2.
There is no need to manually write a Pong, as the server and client both handle responding to a ping with a pong automatically and this is exposed to users.RFC 6455 Section 5.5.3 states that pongs may be sent unsolicited in order to implement a one way heartbeat.
Buffer
$this
a reference to this, so the API can be used fluently
writeQueueFull() : boolean
boolean
true if write queue is full
writeTextMessage( $arg0) : $this
string
$this
a reference to this, so the API can be used fluently