coder / coder/websocket

Use existing JS Websocket

Open
#456 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
5.5k
Forks
372
PR merge metrics
No merged PRs in 30d

Description

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

```go

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the websocket.From and websocket.NetConn entry points shown in the issue, along with the library's WebSocket and JavaScript interop documentation. Determine whether an existing JavaScript WebSocket can be supported and define the expected behavior and tests before implementation; done means the capability is documented and verified with a working example or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, javascript
Domain
networking, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.