Cloudlare Worker Web Sockets - Interacting with database directly

Hi,

I am trying to interact with my database directly using Cloudflare workers, but the database drivers require WebSocket connection, is possible to do this via Cloudflare worker? I tried to use some nodejs libraries but they don’t seem to work.

Thank you for any advice

1 Like

WebSocket support is not added yet, but it’s the “next thing” they will add to workers.

Can I ask which database you are hoping to use?

Ah I see thanks, I wanted use CosmosDB with the Gremlin API

Hard to find information about if it requires websockets, seems to be a json api so should work without websockets? Did you try using this GitHub - RedSeal-co/ts-tinkerpop: Utilities for using Tinkerpop3 via the node-java API in Typescript with webpack?

Thanks for looking it up, the official library for javascript does indeed use web sockets to interact using the graph API unfortunately. Although I did try compiling that to see if it would work.

The library you linked uses java library underneath which itself will probably connect using sockets, so don’t think that would run on Cloudflare worker

Yeah, I just can’t get used to Microsoft documentation, it’s always “too much”. I’ve worked quite a lot with Microsoft Dynamics NAV and their SOAP docs where quite the mood killers :wink:

Anyway, I’m sure they will launch it pretty soon!

1 Like