class SockJSSocket extends ReadStream[Buffer] with WriteStream[Buffer]
You interact with SockJS clients through instances of SockJS socket.
The API is very similar to io.vertx.scala.core.http.WebSocket. It implements both and so it can be used with io.vertx.scala.core.streams.Pump to pump data with flow control.
- Alphabetic
- By Inheritance
- SockJSSocket
- WriteStream
- ReadStream
- StreamBase
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new SockJSSocket(_asJava: AnyRef)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asJava: AnyRef
- Definition Classes
- SockJSSocket → WriteStream → ReadStream → StreamBase
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
close(): Unit
Close it
-
def
drainHandler(handler: Handler[Unit]): SockJSSocket
Set a drain handler on the stream.
Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue is ready to accept buffers again. See io.vertx.scala.core.streams.Pump for an example of this being used.
The stream implementation defines when the drain handler, for example it could be when the queue size has been reduced to
maxSize / 2
.- handler
the handler
- returns
a reference to this, so the API can be used fluently
- Definition Classes
- SockJSSocket → WriteStream
-
def
end(): Unit
Call io.vertx.scala.ext.web.handler.sockjs.SockJSSocket#end.
- Definition Classes
- SockJSSocket → WriteStream
-
def
end(t: Buffer): Unit
Same as io.vertx.scala.core.streams.WriteStream#end but writes some data to the stream before ending.
Same as io.vertx.scala.core.streams.WriteStream#end but writes some data to the stream before ending.
- Definition Classes
- SockJSSocket → WriteStream
-
def
endHandler(endHandler: Handler[Unit]): SockJSSocket
Set an end handler.
Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.
- returns
a reference to this, so the API can be used fluently
- Definition Classes
- SockJSSocket → ReadStream
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exceptionHandler(handler: Handler[Throwable]): SockJSSocket
Set an exception handler on the write stream.
Set an exception handler on the write stream.
- handler
the exception handler
- returns
a reference to this, so the API can be used fluently
- Definition Classes
- SockJSSocket → WriteStream → ReadStream → StreamBase
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
handler(handler: Handler[Buffer]): SockJSSocket
Set a data handler.
Set a data handler. As data is read, the handler will be called with the data.
- returns
a reference to this, so the API can be used fluently
- Definition Classes
- SockJSSocket → ReadStream
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
headers(): MultiMap
Return the headers corresponding to the last request for this socket or the websocket handshake Any cookie headers will be removed for security reasons
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
localAddress(): SocketAddress
Return the local address for this socket
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
pause(): SockJSSocket
Pause the
ReadSupport
.Pause the
ReadSupport
. While it's paused, no data will be sent to thedataHandler
- returns
a reference to this, so the API can be used fluently
- Definition Classes
- SockJSSocket → ReadStream
-
def
remoteAddress(): SocketAddress
Return the remote address for this socket
-
def
resume(): SockJSSocket
Resume reading.
Resume reading. If the
ReadSupport
has been paused, reading will recommence on it.- returns
a reference to this, so the API can be used fluently
- Definition Classes
- SockJSSocket → ReadStream
-
def
setWriteQueueMaxSize(maxSize: Int): SockJSSocket
Set the maximum size of the write queue to
maxSize
.Set the maximum size of the write queue to
maxSize
. You will still be able to write to the stream even if there is more thanmaxSize
items in the write queue. This is used as an indicator by classes such asPump
to provide flow control.The value is defined by the implementation of the stream, e.g in bytes for a io.vertx.scala.core.net.NetSocket, the number of io.vertx.scala.core.eventbus.Message for a io.vertx.scala.core.eventbus.MessageProducer, etc...
- maxSize
the max size of the write stream
- returns
a reference to this, so the API can be used fluently
- Definition Classes
- SockJSSocket → WriteStream
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
uri(): String
Return the URI corresponding to the last request for this socket or the websocket handshake
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
webSession(): Option[Session]
- returns
the Vert.x-Web session corresponding to this socket
-
def
webUser(): Option[User]
- returns
the Vert.x-Web user corresponding to this socket
-
def
write(data: String): SockJSSocket
Write a String to the socket, encoded in UTF-8.
Write a String to the socket, encoded in UTF-8.
- data
the string to write
- returns
a reference to this, so the API can be used fluently
-
def
write(data: Buffer): SockJSSocket
Write some data to the stream.
Write some data to the stream. The data is put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the io.vertx.scala.core.streams.WriteStream#writeQueueFull method before writing. This is done automatically if using a io.vertx.scala.core.streams.Pump.
- data
the data to write
- returns
a reference to this, so the API can be used fluently
- Definition Classes
- SockJSSocket → WriteStream
-
def
writeHandlerID(): String
When a
SockJSSocket
is created it automatically registers an event handler with the event bus, the ID of that handler is given bywriteHandlerID
.When a
SockJSSocket
is created it automatically registers an event handler with the event bus, the ID of that handler is given bywriteHandlerID
.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.
-
def
writeQueueFull(): Boolean
This will return
true
if there are more bytes in the write queue than the value set using io.vertx.scala.core.streams.WriteStream#setWriteQueueMaxSizeThis will return
true
if there are more bytes in the write queue than the value set using io.vertx.scala.core.streams.WriteStream#setWriteQueueMaxSize- returns
true if write queue is full
- Definition Classes
- SockJSSocket → WriteStream