Skip to content

Commit

Permalink
Merge pull request #1103 from jibon57/websocket_config
Browse files Browse the repository at this point in the history
SocketIO: Add optional websocket.Config param
  • Loading branch information
ReneWerner87 committed May 21, 2024
2 parents 58db7f7 + 6d59b4d commit d3d5632
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion socketio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ go get -u github.com/gofiber/contrib/socketio
```go
// Initialize new socketio in the callback this will
// execute a callback that expects kws *Websocket Object
func New(callback func(kws *Websocket)) func(*fiber.Ctx) error
// and optional config websocket.Config
func New(callback func(kws *Websocket), config ...websocket.Config) func(*fiber.Ctx) error
```

```go
Expand Down
4 changes: 2 additions & 2 deletions socketio/socketio.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ var listeners = safeListeners{
list: make(map[string][]eventCallback),
}

func New(callback func(kws *Websocket)) func(*fiber.Ctx) error {
func New(callback func(kws *Websocket), config ...websocket.Config) func(*fiber.Ctx) error {
return websocket.New(func(c *websocket.Conn) {
kws := &Websocket{
Conn: c,
Expand Down Expand Up @@ -269,7 +269,7 @@ func New(callback func(kws *Websocket)) func(*fiber.Ctx) error {

// Run the loop for the given connection
kws.run()
})
}, config...)
}

func (kws *Websocket) GetUUID() string {
Expand Down

0 comments on commit d3d5632

Please sign in to comment.