Using compute as a small websocket server

Hi Folks,

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.

Thanks
Aditya

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.

Thanks for the quick reply @kevin.fleming , i found this starter kit ( GitHub - fastly/compute-starter-kit-rust-fanout: Fanout package template for Rust based Fastly Compute projects. ) but it seems like I can’t play with Fanout on my local machine, just confirming if it is possible to play with Fanout entirely on local machine or not ?

Well… it’s technically possible, but that doesn’t mean it’s easy :slight_smile:

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.

1 Like