class Socket extends Object with IEventEmitter
A Socket is the fundamental class for interacting with browser clients. A Socket belongs to a certain Namespace (by default /) and uses an underlying Client to communicate.
It should be noted the Socket doesn't relate directly to the actual underlying TCP/IP socket and it is only the name of the class.
- Annotations
- @RawJSType() @native()
- Alphabetic
- By Inheritance
- Socket
- IEventEmitter
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Socket()
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
-
def
addListener(eventName: String, listener: Function): Socket.this.type
- Definition Classes
- IEventEmitter
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
client: Client
A reference to the underlying Client object.
A reference to the underlying Client object.
- returns
the Client object.
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
compress(v: Boolean): Socket
Sets a modifier for a subsequent event emission that the event data will only be compressed if the value is true.
Sets a modifier for a subsequent event emission that the event data will only be compressed if the value is true. Defaults to true when you don't call the method.
-
def
conn: Socket
A reference to the underlying Client transport connection (engine.io Socket object).
A reference to the underlying Client transport connection (engine.io Socket object). This allows access to the IO transport layer, which still (mostly) abstracts the actual TCP/IP socket.
- returns
the underlying Client transport connection
-
def
disconnect(close: Boolean): Socket.this.type
Disconnects this client.
Disconnects this client.
- close
If value of close is true, closes the underlying connection. Otherwise, it just disconnects the namespace.
-
val
domain: String
- Definition Classes
- IEventEmitter
-
def
emit(name: String, args: Any*): Socket.this.type
Emits an event identified by the string name to the client.
Emits an event identified by the string name to the client. Any other parameters can be included. All data structures are supported, including Buffer. JavaScript functions can't be serialized/deserialized.
- name
the event name
- args
the event arguments
- Definition Classes
- Socket → IEventEmitter
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
getMaxListeners(): Int
- Definition Classes
- IEventEmitter
-
def
hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
def
id: String
A unique identifier for the session, that comes from the underlying Client.
A unique identifier for the session, that comes from the underlying Client.
- returns
the unique identifier
-
def
in(room: String): Socket
Same as Socket.to()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
-
def
join(name: String, fn: Function = js.native): Socket
Adds the client to the room, and fires optionally a callback fn with err signature (if any).
Adds the client to the room, and fires optionally a callback fn with err signature (if any). The client is automatically a member of a room identified with its session id (see Socket#id). The mechanics of joining rooms are handled by the Adapter that has been configured (see Server#adapter above), defaulting to socket.io-adapter.
-
def
leave(name: String, fn: Function = js.native): Socket
Removes the client from room, and fires optionally a callback fn with err signature (if any).
-
def
listenerCount(eventName: String): Int
- Definition Classes
- IEventEmitter
-
def
listeners(eventName: String): Array[Function]
- Definition Classes
- IEventEmitter
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
on(eventName: String, listener: Function): Socket.this.type
- Definition Classes
- IEventEmitter
-
def
once(eventName: String, listener: Function): Socket.this.type
- Definition Classes
- IEventEmitter
-
def
propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
-
def
removeAllListeners(): Socket.this.type
- Definition Classes
- IEventEmitter
-
def
removeAllListeners(eventName: String): Socket.this.type
- Definition Classes
- IEventEmitter
-
def
removeListener(eventName: String, listener: Function): Socket.this.type
- Definition Classes
- IEventEmitter
-
def
request: Request
A getter proxy that returns the reference to the request that originated the underlying engine.io Client.
A getter proxy that returns the reference to the request that originated the underlying engine.io Client. Useful for accessing request headers such as Cookie or User-Agent.
-
def
rooms: Object
A hash of strings identifying the rooms this client is in, indexed by room name.
A hash of strings identifying the rooms this client is in, indexed by room name.
- returns
A hash of strings
-
def
setMaxListeners(n: Int): Socket.this.type
- Definition Classes
- IEventEmitter
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
to(room: String): Socket
Sets a modifier for a subsequent event emission that the event will only be broadcasted to clients that have joined the given room.
-
def
toLocaleString(): String
- Definition Classes
- Object
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
val
usingDomains: Boolean
- Definition Classes
- IEventEmitter
-
def
valueOf(): Any
- Definition Classes
- Object
-
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
- @throws( ... )