Cloudlare Worker Web Sockets - Interacting with database directly


#1

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


#2

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


#3

Can I ask which database you are hoping to use?


#4

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


#5

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 https://github.com/RedSeal-co/ts-tinkerpop with webpack?


#6

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


#7

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!