I have a very small use-case and I am able to use compute as a backend server for that use-case I am just wondering if there is any way to use compute as a websocket server as well ? Like multiple clients can create channels with compute and my compute has a long running loop which can keep serving these channel independently.
I would like to know if this is a good idea and if there are any starter templates for this. I already found some starter templates but I’m not sure if that covers my above use-case.
It is not possible to do this directly in Fastly Compute, but the Fastly Fanout product (an add-on to Fastly Compute) supports WebSockets and other forms of long-connection content delivery.
Well… it’s technically possible, but that doesn’t mean it’s easy
Fastly Fanout is based on Pushpin, which is open source and free for anyone to use. However, it’s not currently possible to execute the same Compute code in Viceroy (the local testing server) as in the production environment. A member of our Developer Relations team (@harmony7) is planning to work on that later this year, so that it will be possible to run fastly compute serve and run a Compute service which uses Fanout/Pushpin, but it will be many months before that is available.
For now, the only practical way to test Compute services that use Fanout is by using the Fastly production network.