Fast APi web socket streaming

Hi,
I’m trying to get a feed over web socket with JavaScript in anvil and I have some issues getting a feed to work ok, is it any one else who has done this or is this not a feasible way with anvil
I built a simple Fast Api with uvicorn and gunicorn running on my external server, so https is there, and I am able to get connected. But there is something wrong I can’t get my head around. So I thought I’ll just ask, if there is other things than wss that I don’t know about, before I go deeper into this rabbit hole.

Here is my simple java snippet that I call with anvil.js for this test.

function startWebSocket(start_utctime) {
    const ws = new WebSocket(`wss://john.doe.co/ws?start_utctime=${start_utctime}`);

Kind Regards
Per

1 Like

Hi,

you stand more chance of getting a response if you can detail what you’ve already tried along with the results. Unfortunately just “something is wrong” doesn’t give anyone much to go on.

2 Likes

Hi,
sorry for the unclear question.
Well I got the answer now, it was a linux thingy with premissions on tmp file between nginx and gunicorn. Who could imagine that…:wink: So anvil will easily get a great connection with web socket over a simple JavaScript snippet, problem is to build the wss web socket itself, anyway for me it was. I wished it was as simple as the anvil.server.call that I use all the time.
Thanks
Per

1 Like