Categories

Makahiya, Week 11

Hi,

During the second part of this week, I continued my work with websockets. First, I made them be able to communicate in both ways (in the beginning, I was only sending data, now I can also receive some simultaneously). Then, I tried again to run gunicorn on Heroku. The problem was that gunicorn needs to the port to use in a config file but Heroku allows to use only one specific port that changes every time to deploy. I found a trick that consists in modifying the config file with sed during the deployment. So I was able to deploy our server on Heroku, but we found later that Heroku closes websockets if you don’t use them during 2 minutes, so as we don’t want to ping the server continuously, we will have to deploy our server elsewhere.

Then, I tried to have multiple websockets concurrently. I wanted each socket to have a different URL, the difference being a number at the end of it. With pyramid, it is easy to dispatch URLs with such variables in it and to use the values of these variables for normal views. But aiopyramid that I use to handle websockets like views doesn’t give access to this information. After a long search, I found the problem to be solvable only by adding a line in the code of the library. Later, I also handled the closing of websockets : it crashed on every disconnection, so when we wanted to reopen a websocket at the same URL, it didn’t work. Now, the websockets are properly closed upon disconnection and can be reopened later without any problem.

Next week, I will continue working on the server.

Tanguy

Leave a Reply