stardance has been extended another month! the new deadline is october 31 :)

You are browsing as a guest. Sign up (or log in) to start making projects!

48m 40s logged

Devlog #4: Wrote a web socket

TL;DR: Wrote a simple asynchronous web socket to connect backend with frontend.


Goal for this session:

Write a backend connection to upcoming frontend

What I did:

Wrote a script that turns snapshots from the aggregator into JSON and sends them to the browser window through a websocket. It worked pretty well (see the screenshots)

Problems I hit:

I spent a while searching for why is the port i am trying to use already taken (I could not open connection through it) and it turned out that MY OWN SERVER.PY WAS ALREADY RUNNING AND BLOCKING THE PORT. Nonetheless, lesson learned.
I also had problem with websocket.serve expecting only one argument while my handler needed two, but I solved it with lambda temporary function.

What I learned

  • What a websocket is
  • What a async function is
  • That I can use lambda ws: handler(ws, agg) to pass more arguments into websocket.serve when I need to.

Next up:

  • Create the 3D engine in JS
0
15

Comments 0

No comments yet. Be the first!