Giter VIP home page Giter VIP logo

Comments (8)

manucorporat avatar manucorporat commented on April 26, 2024 30

Please, try this:

r := gin.New()
r.GET("/ws", func(c *gin.Context) {
    handler := websocket.Handler(EchoServer)
    handler.ServeHTTP(c.Writer, c.Req)
})
r.Run(":8080")

from gin.

manucorporat avatar manucorporat commented on April 26, 2024 1

Already merged in master ;)

from gin.

PEKTOP avatar PEKTOP commented on April 26, 2024

@manucorporat, thanks!

from gin.

PEKTOP avatar PEKTOP commented on April 26, 2024

@manucorporat , after last update i try:

r := gin.New()
r.GET("/ws", func(c *gin.Context) {
    handler := websocket.Handler(EchoServer)
    handler.ServeHTTP(c.Writer, c.Req)
})
r.Run(":8080")

Log:

PANIC: interface conversion: *gin.responseWriter is not http.Hijacker: missing method Hijack

from gin.

zmarcantel avatar zmarcantel commented on April 26, 2024

I have added the .Hijack() method and an example in my working fork as part of #16, but due to some differences in practice my fork has become incompatible.

I don't want to double the work/headache for myself or the repo maintainer so I won't be making another fork to submit another pull request over a renamed function or two.

If you wanna dig in, look here:
https://github.com/zmarcantel/gin

The relevant parts are in:
response_writer.go
examples/websockets/example_websocket.go

from gin.

olebedev avatar olebedev commented on April 26, 2024

#105

from gin.

manucorporat avatar manucorporat commented on April 26, 2024

Issue fixed! merged in develop:
4a24c47
7a87c5c
8f1bbc6

from gin.

sjbog avatar sjbog commented on April 26, 2024

@manucorporat, push to master, so that "go get" would work

from gin.

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.