Giter VIP home page Giter VIP logo

Comments (3)

zishang520 avatar zishang520 commented on June 20, 2024 1

@ZinedineR Due to network reasons, an offline js library is used. You can also use the js library provided by cdn. You mainly need to debug the js files integrated in socket.io for golang.

from socket.io.

zishang520 avatar zishang520 commented on June 20, 2024

Hello, regarding the problem you described, here is what may be helpful:

  1. There are currently some comment snippets in the golang source code containing examples. Of course, you can also view the socket.io documentation directly: https://socket.io/docs/v4/server-initialization/. There is almost no big difference between golang syntax and nodejs.
  2. You can clone the repository https://github.com/zishang520/socket.io-test. The socket.io.go file may be helpful to you. You can also execute make socket.io to run the program and then visit http://127.0.0.1:9999/index.html.

Finally, thank you for your choice. If you have any questions, please feel free to ask.

from socket.io.

ZinedineR avatar ZinedineR commented on June 20, 2024

Oh hello Zishang520, I have successfully created gin server with the socket.io package you created.

type HttpServe struct {
router *gin.Engine
serverio *socket.Server
}
func (h *HttpServe) setupSocketio() {
h.router.GET("/socket.io/*any", gin.WrapH(h.serverio.ServeHandler(nil)))
h.router.POST("/socket.io/*any", gin.WrapH(h.serverio.ServeHandler(nil)))
h.router.StaticFS("/public", http.Dir("./app/api/asset"))
}

the server worked well, but since this package is still new for me, thank you for creating this, since we need socket.io package for golang that support 4.x.

One more question, I noticed in the socket.io-test, your html uses this for js script

<script type="text/javascript" src="http://127.0.0.1:9999/socket.io/socket.io.min.js"></script>

Mine is using the official socket io js package for 4.6.0, and it still working. Why in the example use local js?

from socket.io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.