Last active
January 26, 2023 07:56
-
-
Save CodaBool/2ce5467b7f17e17172b97aaf032e8c20 to your computer and use it in GitHub Desktop.
Q1 2023 all methods and useful methods from zishang520/socket.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/zishang520/socket.io | |
// sources | |
socket = io.Sockets() | |
engine = io.Engine() | |
adapter = io.Adapter() | |
io = io | |
// Useful | |
p("io Name", io.Sockets().Name()) // "/" | |
p("io Sockets", io.FetchSockets()) | |
p("io Sockets IDs", io.Sockets().Ids()) // SUCCESS int | |
p("io Engine ClientsCount", io.Engine().ClientsCount()) // SUCCESS int | |
p("io Path", io.Path()) // /socket.io | |
p("Data", client.Data()) // can have set data with client.SetData("ok") | |
p("EventNames", client.EventNames()) // ["create","run","disconnect"] | |
log.Print("client ID ", client.Id()) | |
log.Print("connected ", client.Connected()) // true | |
p("Handshake", client.Handshake()) | |
client.Emit("wow", "a_string") | |
p("Of", io.Of(any )) // does some namespace stuff | |
p("Close", io.sockets) | |
p("Close", io.Close()) // goes over all .sockets and does 3 close sections | |
p("To", io.To(...Room)) | |
p("Send", io.Send(...any)) | |
p("SocketsJoin", io.SocketsJoin(...Room)) | |
p("SocketsLeave", io.SocketsLeave(...Room)) | |
p("DisconnectSockets", io.DisconnectSockets(bool)) | |
printMap("rooms", io.Sockets().Adapter().Rooms()) | |
// Not sure how these work | |
p("FetchSockets", io.Sockets().FetchSockets()) | |
p("io SocketRooms", io.Adapter().SocketRooms(id)) | |
p("io AllSockets", io.Sockets().AllSockets()) | |
// client | |
Acks | |
AddListener | |
Broadcast | |
Clear | |
Client | |
Compress | |
Conn | |
Connected | |
Data | |
Disconnect | |
Disconnected | |
Emit | |
EmitReserved | |
EmitUntyped | |
EventNames | |
Except | |
GetMaxListeners | |
Handshake | |
Id | |
In | |
Join | |
Leave | |
Len | |
ListenerCount | |
Listeners | |
ListenersAny | |
ListenersAnyOutgoing | |
Local | |
NotifyOutgoingListeners | |
Nsp | |
OffAny | |
OffAnyOutgoing | |
On | |
OnAny | |
OnAnyOutgoing | |
Once | |
PrependAny | |
PrependAnyOutgoing | |
RemoveAllListeners | |
RemoveListener | |
Request | |
Rooms | |
Send | |
SetData | |
SetMaxListeners | |
Timeout | |
To | |
Use | |
Volatile | |
Write | |
// Engine methods | |
ddListener | |
Attach | |
Clear | |
Clients | |
ClientsCount | |
Close | |
CreateTransport | |
Emit | |
EventNames | |
GenerateId | |
GetMaxListeners | |
HandleRequest | |
HandleUpgrade | |
Handshake | |
HttpServer | |
Len | |
ListenerCount | |
Listeners | |
New | |
On | |
Once | |
Opts | |
RemoveAllListeners | |
RemoveListener | |
ServeHTTP | |
SetHttpServer | |
SetMaxListeners | |
Upgrades | |
Verify | |
// Adapter Methods | |
AddAll | |
AddListener | |
AddSockets | |
Broadcast | |
BroadcastWithAck | |
Clear | |
Close | |
Del | |
DelAll | |
DelSockets | |
DisconnectSockets | |
Emit | |
EventNames | |
FetchSockets | |
GetMaxListeners | |
Init | |
Len | |
ListenerCount | |
Listeners | |
New | |
Nsp | |
On | |
Once | |
RemoveAllListeners | |
RemoveListener | |
Rooms | |
ServerCount | |
ServerSideEmit | |
SetBroadcast | |
SetMaxListeners | |
Sids | |
SocketRooms | |
Sockets | |
// IO | |
Adapter | |
AddListener | |
AllSockets | |
Attach | |
Bind | |
Clear | |
Close | |
Compress | |
ConnectTimeout | |
DisconnectSockets | |
Emit | |
EmitReserved | |
EmitUntyped | |
Encoder | |
Engine | |
EventNames | |
Except | |
FetchSockets | |
GetMaxListeners | |
In | |
Len | |
Listen | |
ListenerCount | |
Listeners | |
Local | |
Of | |
On | |
Once | |
Path | |
RemoveAllListeners | |
RemoveListener | |
Send | |
ServeClient | |
ServeHandler | |
ServerSideEmit | |
SetAdapter | |
SetConnectTimeout | |
SetMaxListeners | |
SetPath | |
SetServeClient | |
Sockets | |
SocketsJoin | |
SocketsLeave | |
Timeout | |
To | |
Use | |
Volatile | |
Write | |
# Socket | |
Adapter | |
Add | |
AddListener | |
AllSockets | |
Clear | |
Compress | |
DisconnectSockets | |
Emit | |
EmitReserved | |
EmitUntyped | |
EventEmitter | |
EventNames | |
Except | |
FetchSockets | |
GetMaxListeners | |
Ids | |
In | |
Len | |
ListenerCount | |
Listeners | |
Local | |
Name | |
On | |
Once | |
RemoveAllListeners | |
RemoveListener | |
Send | |
Server | |
ServerSideEmit | |
SetMaxListeners | |
Sockets | |
SocketsJoin | |
SocketsLeave | |
Timeout | |
To | |
Use | |
Volatile | |
Write |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment