# How to use googollee/go-socket.io with gin gonic

**URL:** <https://forum.golangbridge.org/t/how-to-use-googollee-go-socket-io-with-gin-gonic/20417>\
**Category:** Getting Help\
**Created:** [September 1, 2020, 9:19pm UTC](https://forum.golangbridge.org/t/how-to-use-googollee-go-socket-io-with-gin-gonic/20417 "2020-09-01T21:19:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![illud](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/illud/32/6570_2.png) [@illud](https://forum.golangbridge.org/u/illud)\
**Post date:** [September 1, 2020, 9:19pm UTC](https://forum.golangbridge.org/t/how-to-use-googollee-go-socket-io-with-gin-gonic/20417/1 "2020-09-01T21:19:27Z")

</div>

So i want to know how to have [socket.io](http://socket.io) and use it with gin gonic

```
package main

import (
"github.com/gin-gonic/gin"
"github.com/googollee/go-socket.io"
)
func main() {
    r := gin.Default()
    r.GET("/ping", socketioFunc)
    r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}

func socketioFunc(c *gin.Context) {
//SOCKET IO STOFF
	c.JSON(200, gin.H{
		"message": "pong",
	})
}
```

---

<div class="post-metadata">

**Author:** ![lutzhorn](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/lutzhorn/32/8119_2.png) [@lutzhorn](https://forum.golangbridge.org/u/lutzhorn)\
**Post date:** [September 2, 2020, 11:52am UTC](https://forum.golangbridge.org/t/how-to-use-googollee-go-socket-io-with-gin-gonic/20417/2 "2020-09-02T11:52:01Z")

</div>

Is this working? If not, what does _not_ work?

---

<div class="post-metadata">

**Author:** ![illud](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/illud/32/6570_2.png) [@illud](https://forum.golangbridge.org/u/illud)\
**Post date:** [September 2, 2020, 1:28pm UTC](https://forum.golangbridge.org/t/how-to-use-googollee-go-socket-io-with-gin-gonic/20417/3 "2020-09-02T13:28:16Z")

</div>

Hello, the [socket.io](http://socket.io) code is mising becouse i don’t know how yo implement .

---

<div class="post-metadata">

**Author:** ![lutzhorn](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/lutzhorn/32/8119_2.png) [@lutzhorn](https://forum.golangbridge.org/u/lutzhorn)\
**Post date:** [September 2, 2020, 3:00pm UTC](https://forum.golangbridge.org/t/how-to-use-googollee-go-socket-io-with-gin-gonic/20417/4 "2020-09-02T15:00:09Z")

</div>

There are examples for how to use [go-socket.io](http://go-socket.io): [https://github.com/googollee/go-socket.io#example](https://github.com/googollee/go-socket.io#example). Maybe it is possible to register a socket-io `Server` with Gin as it is done with `http.Handle` in the example. But this would happen in `main`, not in `socketioFunc`.

---

<div class="post-metadata">

**Author:** ![illud](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/illud/32/6570_2.png) [@illud](https://forum.golangbridge.org/u/illud)\
**Post date:** [September 2, 2020, 3:08pm UTC](https://forum.golangbridge.org/t/how-to-use-googollee-go-socket-io-with-gin-gonic/20417/5 "2020-09-02T15:08:10Z")

</div>

Yeah, but i have to used it with gin gonic and has to be in anotehr function

---

<div class="post-metadata">

**Author:** ![lutzhorn](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/lutzhorn/32/8119_2.png) [@lutzhorn](https://forum.golangbridge.org/u/lutzhorn)\
**Post date:** [September 2, 2020, 3:09pm UTC](https://forum.golangbridge.org/t/how-to-use-googollee-go-socket-io-with-gin-gonic/20417/6 "2020-09-02T15:09:09Z")

</div>

Good luck.

Meaning: “I have to” will probably not be enough to convince the libraries to do something (what exactly?) they are not designed for.

---

<div class="post-metadata">

**Author:** ![system](https://forum.golangbridge.org/uploads/default/original/2X/5/5ad234f7c3dbc68b6cc72d338ce4f2973d9fd81c.png) [@system](https://forum.golangbridge.org/u/system)\
**Post date:** [December 1, 2020, 3:09pm UTC](https://forum.golangbridge.org/t/how-to-use-googollee-go-socket-io-with-gin-gonic/20417/7 "2020-12-01T15:09:16Z")

</div>

Closed on December 1, 2020, 3:09pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
