Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide websocket example? #25

Closed
dlintw opened this issue Mar 13, 2019 · 1 comment
Closed

Provide websocket example? #25

dlintw opened this issue Mar 13, 2019 · 1 comment

Comments

@dlintw
Copy link

dlintw commented Mar 13, 2019

In gin, it is possible, gin-gonic/gin#51, but is it possible to use websocket in RTE?

@jwilner
Copy link
Owner

jwilner commented Apr 12, 2019

Hi @dlintw -- sorry I missed this comment until now. In the linked examples, the type returned by websocket.Handler(EchoServer) implements http.Handler, so you should be able to use:

mux := rte.Must(rte.Routes(
    "GET /ws", websocket.Handler(echoServer),
)
http.ListenAndServe(mux)

RTE provides the standard library response writer types, so it should all work as expected. Let me know how it goes!

@jwilner jwilner closed this as completed May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants