Quark
#
Modules #
quark/actionquark/appquark/bubblesquark/bufferquark/checkboxquark/cssquark/ctrquark/defsquark/dialogquark/eventquark/fontquark/fsquark/hashquark/httpquark/indexquark/jsonbquark/keyboardquark/lmdbquark/mediaquark/navquark/netquark/osquark/pathquark/pkgquark/screenquark/statequark/stepperquark/storagequark/testquark/typesquark/uriquark/utilquark/viewquark/windowquark/wsquark/_bufferquark/_commonquark/_decoratorsquark/_eventquark/_extquark/_md5quark/_sha1quark/_sha256quark/_utilquark/_watching
Quark v1.4.0 Documentation
Contents
quark/ws #
Enum: PacketType #
PacketType #
Defines the types of packets used in WSClient communication.
Interface: Packet #
Packet #
Represents a packet structure used in WSClient communication.
Class: WSConversation #
WSConversation #
WSConversation is extended from WebSocket to provide a WSClient connection.
Extends: WebSocket
wsconversation.token #
Session token
readonly token:
wsconversation.autoReconnect #
autoReconnect:
wsconversation.connect() #
connect(): void
@override
Connect to the WebSocket server.
wsconversation.close() #
close()
@override
Close the conversation connection.
wsconversation.sendPacket(p) #
Send a packet to the server.
sendPacket(data: any, p: Packet): Promise<void>
Parameters:
data— Packet data to send
Class: WSCEvent #
WSCEvent #
wscevent.remoteSender #
readonly remoteSender: string
wscevent.constructor(data?,sender?) #
constructor(data?: any, sender?: string)
Parameters:
data?— Event datasender?— Remote sender id
Class: WSClient #
WSClient #
WSClient is Qktool's WebSocket service client.
Through it, you can call the service methods of server provided or listen to the service events.
Extends: Notification<WSCEvent>
wsclient.name #
Service name on the server
readonly name: string
wsclient.conv #
Conversation instance
readonly conv: WSConversation
wsclient.onLoad #
Triggered when the client is loaded and ready to use.
@eventonLoad:EventNoticer<WSCEvent>
wsclient.constructor(serviceName,conv) #
constructor(serviceName: string, conv: WSConversation)
Parameters:
serviceName— Service name on the serverconv— Conversation instance
wsclient.receiveMessage(packet) #
To handle received messages from the server.
receiveMessage(packet: Packet): Promise<void>
wsclient.callMethod(method,data,sender) #
The remote service calls a method on the client by the method name.
callMethod(method: string, data: any, sender: string)
@parammethod: Method name to call@paramdata?: Data to send@paramtimeout?: Timeout in milliseconds, default 120s@paramsender?: Sender name, default this service name
wsclient.send(method,data?,sender?) #
To call a method on the server but there will be no callback.
send(method: string, data?: any, sender?: string)
Parameters:
method— Method name to calldata?— Data to sendsender?— Sender name, default this service name