# HTTP.jl Websockets- help getting started

**URL:** <https://discourse.julialang.org/t/http-jl-websockets-help-getting-started/102867>\
**Category:** Web Stack\
**Created:** [August 16, 2023, 3:50pm UTC](https://discourse.julialang.org/t/http-jl-websockets-help-getting-started/102867 "2023-08-16T15:50:41Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![NAS](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nas/32/47432_2.png) [@NAS](https://discourse.julialang.org/u/NAS)\
**Post date:** [August 18, 2023, 3:53pm UTC](https://discourse.julialang.org/t/http-jl-websockets-help-getting-started/102867/4 "2023-08-18T15:53:16Z")

</div>

Thanks for the input. I dug through the source a little and came up with this:

```julia
function rawws(url,headers =[])
    headers = [
        "Upgrade" => "websocket",
        "Connection" => "Upgrade",
        "Sec-WebSocket-Key" => base64encode(rand(Random.RandomDevice(), UInt8, 16)),
        "Sec-WebSocket-Version" => "13",
        headers...
    ]
    r = HTTP.openraw("GET",url,headers)[1]

    ws = WebSockets.WebSocket(r)
    return ws
end

```

This is just constructed from parts and pieces of the HTTP.jl package and essentially gives a raw web socket that you have to manage manually. I’m using this with SurrealDB and so far it is working well. I see the intent and benefit of having the full lifecycle of the WS managed and ensuring that it is closed, but also having a persistent socket has been handy for prototyping and troubleshooting.

I’d love to make this available for anyone else who might find it useful, but I’m not sure of a few things:

1. Is this a reasonable solution? (Works for me, but does it make sense beyond my use case?)
2. If yes, I don’t know how to submit a PR, but willing to learn. Any resources for a newbie?

---

_[View the full topic](https://discourse.julialang.org/t/http-jl-websockets-help-getting-started/102867)._
