Categorygithub.com/hhuuson97/socket.io-go
modulepackage
0.0.2
Repository: https://github.com/hhuuson97/socket.io-go.git
Documentation: pkg.go.dev

# README

Socket.IO - Go

This is a Socket.IO library for Go.

Caveats & incompatibilities

  • When doing a server side emit, ack callback cannot be given.
  • Dynamic namespaces feature is not supported.

Compatibility table

The least supported Socket.IO version is 3.0. If you have an older version of Socket.IO in your other projects, please consider upgrading your dependencies.

JavaScript Socket.IO versionSocket.IO protocol revisionEngine.IO protocol revisionsocket.io-go version
0.9.x1, 21, 2Not supported
1.x, 2.x3, 43Not supported
3.x, 4.x540.x

Q&A and troubleshooting

Should I use Socket.IO?

While writing this package, I noticed that Socket.IO is a very complicated and bloated library. As of writing (2024), WebSocket is a very feasible option. In my opinion, one should prefer to use WebSocket if features specific to Socket.IO (e.g. timeout, reconnection, adapter) are not needed.

Sometimes Socket.IO doesn't notice when the network connection is down.

Try reducing pingInterval and pingTimeout.

Guide

See the examples directory for the chat example. See pkg.go.dev for documentation.

Reserved events

The names below should not be used as event names (Emit and OnEvent). Otherwise, panic will occur.

connect
connect_error
disconnect
disconnecting

open
error
ping

close
reconnect
reconnect_attempt
reconnect_error
reconnect_failed

Transports

If you are a contributor, please see: Developing a Transport

JSON

JSON serialization is highly customizable. Under the parser/json/serializer directory there are different packages for JSON serialization:

NameDescriptionUsage
stdjsonstdlib's encoding/json. This is the default serializer.README.md
go-jsonREADME.md
sonicREADME.md
fastConditionally uses sonic or go-json.README.md

Contributing

Contributions are very welcome. Please read this page.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
This function creates a new Manager for client sockets.
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
This is a wrapper for the errors internal to socket.io.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author