Back

realtime

  • 0
  • Self Hosted
Binyamin
15 Aug, 2023, 17:43

You can manualy use it by using any server-side WebSocket libraries

TL;DR
The user is seeking help understanding how to implement realtime functionality on their server. They are introduced to Appwrite Webhooks as a solution. The user expresses concerns about the amount of work and lack of backend experience. There is no specific solution or conclusion in the thread.
Drake
16 Aug, 2023, 01:39

What's your use case?

Mr.ppDulce
16 Aug, 2023, 13:39

sorry about the delay response i want to be able to listen for document creations on a server

Mr.ppDulce
16 Aug, 2023, 13:40

however while the ws connection does say is successful

Mr.ppDulce
16 Aug, 2023, 13:40

i do not get any of the events im expecting

Mr.ppDulce
16 Aug, 2023, 13:40

i usually get these two messages

Mr.ppDulce
16 Aug, 2023, 13:40

Received: '{"type":"connected","data":{"channels":["databases.64be8855815ab10ea802.collections.64be886f3f3564bb2192.documents"],"user":null}}' app.js:48 64 Received: '{"type":"error","data":{"code":0,"message":"array_key_exists(): Argument #2 ($array) must be of type array, int given"}}'

Mr.ppDulce
16 Aug, 2023, 13:41
TypeScript
    "accept-language": "en-US,en;q=0.9",
    "cache-control": "no-cache",
    "pragma": "no-cache",
    "sec-websocket-extensions": "permessage-deflate; client_max_window_bits",
    // "sec-websocket-key": "/oj9X0GI+Sqbh05hLCbqQw==",
    "sec-websocket-version": "13"
  });```
Mr.ppDulce
16 Aug, 2023, 13:42

not sure if i am missing something

Mr.ppDulce
16 Aug, 2023, 13:43

i guess i could use a cloud function on this instance and have another messaging api let my server know about the creation

Mr.ppDulce
16 Aug, 2023, 13:43

but that just seems like alot of work

Mr.ppDulce
16 Aug, 2023, 14:05

nvm the second error was because i was sending data to the server from the client

Mr.ppDulce
16 Aug, 2023, 14:57

oh theres a whole auth process that needs to. be done once connected passing the session back to the server to be able to receive the events

Mr.ppDulce
16 Aug, 2023, 14:58

hmmm now this has become some work

Drake
16 Aug, 2023, 15:54

so typically, servers are able to have an endpoint listening for http requests. can you do that?

Mr.ppDulce
16 Aug, 2023, 16:26

sorry dont have much experience with backend

Drake
16 Aug, 2023, 16:27

what are you doing for your server? what do you have set up?

Mr.ppDulce
16 Aug, 2023, 16:27

like have a cloudfunction call my http endpoint

Mr.ppDulce
16 Aug, 2023, 16:27

right now i just have basic express server

Mr.ppDulce
16 Aug, 2023, 16:28

but i think you are telling me define a route and call that route

Mr.ppDulce
16 Aug, 2023, 16:28

which makes sense now that i think about it

Drake
16 Aug, 2023, 16:29

yes, exactly. you can use Appwrite Webhooks https://appwrite.io/docs/webhooks. The webhook can be configured to make a POST request to your express server with the data just like the realtime payload.

This is why it's typically not needed to have realtime in the server SDK

Mr.ppDulce
16 Aug, 2023, 16:29

ohhhh thats awesome

Mr.ppDulce
16 Aug, 2023, 16:29

makes sense

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more