0

Websockets are particularly important when it comes to integrating Weavy because it helps the Weavy environment in handling realtime communications. In the documentation, there are references given for UI kits related to Javascript, Javascript with .Net, etc. But if I am making my own UI with technologies other than the ones mentioned in the documentation, then what is the way to connect to websockets while integrating Weavy?

I tried finding about connecting websockets with custom UI in the documentation but didn't get any proper answer or any FAQ related to it.

1 Answers1

2

At the moment, there is no open api to connect to the Weavy realtime server. This is something that we will create in the future. But if you want to take a look at how it's done, for example in the React UI kit, you can check out how the WeavyClient connects to the realtime hub.

https://github.com/weavy/weavy-uikit-react/blob/a65e66a10e1e8d7483f45b431275248c28f15a17/src/client/WeavyClient.ts#L23

When a connection is established, you have to susbscribe to specific events from the Weavy server.

The Subscribe server method expects a group name which is in a specific format. This is as I said not documented yet. But as an example, if you want to listen to created messages in a specific app, you have to use the format:

a[app id]:[event]

Example:

a13:message_created

The a means it's an app, the number 13 is the id of the app, and message_created is the event you want to subscribe to.

Here is an example from a component in the React UI Kit:

https://github.com/weavy/weavy-uikit-react/blob/a65e66a10e1e8d7483f45b431275248c28f15a17/src/components/Messages.tsx#L68

To summarize... No open api yet. It might seem a bit complicated since what I showed above is internal logic and not what is expected to be exposed.