modulepackage
0.0.0-20240218211834-b7f01d1e5ec6
Repository: https://github.com/antoniodipinto/ikisocket.git
Documentation: pkg.go.dev
# README
Last update
Here's What's Happening
This repository has moved to a new URL, directly under Fiber's Contrib Repo. This move is part of my effort to enhance the project and offer you better features and support.
Here: https://github.com/gofiber/contrib/blob/main/socketio/README.md
Important note, the name has now changed from ikisocket to Socket.IO
If you wish to switch directly to the new repository, ensure you update your code accordingly.
From this:
import (
"github.com/antoniodipinto/ikisocket"
"github.com/gofiber/contrib/websocket"
"github.com/gofiber/fiber/v2"
)
ikisocket.On("EVENT_NAME", func(ep *ikisocket.EventPayload) {})
ikisocket.New(func(kws *ikisocket.Websocket){})
To this
import (
"github.com/gofiber/contrib/socketio"
"github.com/gofiber/contrib/websocket"
"github.com/gofiber/fiber/v2"
)
socketio.On("EVENT_NAME", func(ep *socketio.EventPayload) {})
socketio.New(func(kws *socketio.Websocket){})
Quick Notes:
- Bookmark the new repo: Make sure to star the new repository to keep up with updates.
- Future Contributions: Please direct all new issues and contributions to the new repo.
- Continuous Support: Your feedback and contributions are always highly appreciated.
WebSocket wrapper for Fiber v2 with events support
Based on Fiber Websocket and inspired by Socket.io
Star History
# Packages
No description provided by the author
# Functions
Broadcast to all the active connections.
EmitTo Emit to a specific socket connection.
EmitToList Emit the message to a specific socket uuids list Ignores all errors.
Fire custom event on all connections.
No description provided by the author
On Add listener callback for an event into the listeners list.
# Constants
BinaryMessage denotes a binary data message.
CloseMessage denotes a close control message.
EventClose Fired when the connection is actively closed from the server.
EventConnect Fired on first connection.
EventDisconnect Fired on disconnection The error provided in disconnection event is defined in RFC 6455, section 11.7.
EventError Fired when some error appears useful also for debugging websockets.
EventMessage Fired when a Text/Binary message is received.
EventPing More details here: @url https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#Pings_and_Pongs_The_Heartbeat_of_WebSockets.
Supported event list.
PingMessage denotes a ping control message.
PongMessage denotes a pong control message.
TextMessage denotes a text data message.
# Variables
ErrorInvalidConnection The addressed Conn connection is not available anymore error data is the uuid of that connection.
ErrorUUIDDuplication The UUID already exists in the pool.
MaxSendRetry define max retries if there are socket issues.
No description provided by the author
ReadTimeout Instead of reading in a for loop, try to avoid full CPU load taking some pause.
RetrySendTimeout retry after 20 ms if there is an error.
# Structs
EventPayload Event Payload is the object that stores all the information about the event and the connection.
No description provided by the author