Class WebSocketClient
Inheritance
BaseObject
WebSocketClient
Inherited Members
BaseObject.type
BaseObject.valid
BaseObject.id
BaseObject.destroy
BaseObject.getMetaDataKeys
BaseObject.getSyncedMeta
BaseObject.hasSyncedMeta
BaseObject.getSyncedMetaKeys
BaseObject.refCount
Package: @altmp/altv-types
Syntax
class WebSocketClient extends BaseObject
Constructors
|
Improve this Doc
View Source
WebSocketClient(string)
Declaration
WebSocketClient(url: string): WebSocketClient
Parameters
Type |
Name |
Description |
string |
url |
|
Properties
|
Improve this Doc
View Source
autoReconnect
Declaration
public autoReconnect: boolean
Property Value
|
Improve this Doc
View Source
perMessageDeflate
Declaration
public perMessageDeflate: boolean
Property Value
|
Improve this Doc
View Source
pingInterval
Declaration
public pingInterval: number
Property Value
|
Improve this Doc
View Source
url
Declaration
Property Value
|
Improve this Doc
View Source
readyState
Declaration
public readonly readyState: WebSocketReadyState
Property Value
Methods
|
Improve this Doc
View Source
getByID(number)
Declaration
public static getByID(id: number): null | WebSocketClient
Parameters
Type |
Name |
Description |
number |
id |
|
Returns
|
Improve this Doc
View Source
on("open", () => void)
Declaration
public on(eventName: "open", listener: () => void): void
Parameters
Type |
Name |
Description |
"open" |
eventName |
|
() => void |
listener |
|
|
Improve this Doc
View Source
on("close", (code: number, reason: string) => void)
Declaration
public on(eventName: "close", listener: (code: number, reason: string) => void): void
Parameters
Type |
Name |
Description |
"close" |
eventName |
|
(code: number, reason: string) => void |
listener |
|
|
Improve this Doc
View Source
on("message", (message: string) => void)
Declaration
public on(eventName: "message", listener: (message: string) => void): void
Parameters
Type |
Name |
Description |
"message" |
eventName |
|
(message: string) => void |
listener |
|
|
Improve this Doc
View Source
on("error", (error: string) => void)
Declaration
public on(eventName: "error", listener: (error: string) => void): void
Parameters
Type |
Name |
Description |
"error" |
eventName |
|
(error: string) => void |
listener |
|
|
Improve this Doc
View Source
off(string, (...args: any[]) => void)
Declaration
public off(eventName: string, listener: (...args: any[]) => void): void
Parameters
Type |
Name |
Description |
string |
eventName |
|
(...args: any[]) => void |
listener |
|
|
Improve this Doc
View Source
start()
Declaration
|
Improve this Doc
View Source
stop()
Declaration
|
Improve this Doc
View Source
send(string | ArrayBuffer | ArrayBufferView)
Declaration
public send(message: string | ArrayBuffer | ArrayBufferView): boolean
Parameters
Type |
Name |
Description |
string | ArrayBuffer | ArrayBufferView |
message |
|
Returns
|
Improve this Doc
View Source
addSubProtocol(string)
Declaration
public addSubProtocol(protocol: string): void
Parameters
Type |
Name |
Description |
string |
protocol |
|
|
Improve this Doc
View Source
getSubProtocols()
Declaration
public getSubProtocols(): readonly string[]
Returns
Type |
Description |
readonly string[] |
|
|
Improve this Doc
View Source
Declaration
public setExtraHeader(header: string, value: string): void
Parameters
Type |
Name |
Description |
string |
header |
|
string |
value |
|
|
Improve this Doc
View Source
getEventListeners(null | string)
Declaration
public getEventListeners(eventName: null | string): readonly (...args: any[]) => void[]
Parameters
Type |
Name |
Description |
null | string |
eventName |
|
Returns
Type |
Description |
readonly (...args: any[]) => void[] |
|