Skip to content

Use existing JS Websocket #456

New issue

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

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

Already on GitHub? # to your account

Open
foxt opened this issue Jul 15, 2024 · 0 comments
Open

Use existing JS Websocket #456

foxt opened this issue Jul 15, 2024 · 0 comments

Comments

@foxt
Copy link

foxt commented Jul 15, 2024

Hello, I am wondering, with this library, is it possible to use an existing WebSocket that was created in JS land, something like

exportConnect := js.FuncOf(func(this js.Value, args []js.Value) any {
    // ...
    
    socket := args[0]
    conn, _, err := websocket.From(ctx, socket)
    netconn := websocket.NetConn(ctx, conn, websocket.MessageBinary)

    // ...
})
js.Global().Set("go__connect", exportConnect)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant