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

Use existing JS Websocket #456

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)
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

1 participant