Hi, all,
I am trying to make a very simple demo. The enviroment from my side is:
- Mac OS runs y-websocket’s sample server (server.js under bin folder) and also a client (called initiator).
- Windows VM runs another client (called collaborator).
The code for both clients is
let yjsDoc = new Y.Doc();
let yjsArray = yjsDoc.getArray("array");
if (role == "initiator") {
let status = await connectToServer(yjsDoc, 'ipaddr', 1234, 'demo');
await processInitiatorTasks(yjsArray);
} else {
let status = await connectToServer(yjsDoc, 'ipaddr', 1234, 'demo');
await processCollaboratorTasks(yjsArray);
}
inside processInitiatorTasks function, initiator tries to add several integers to the array,
yjsArray.push([0]);
yjsArray.push([1]);
and in processCollaboratorTasks function, collaborator tries to get the numbers from the array
yjsArray.get(0);
yjsArray.get(1);
However, the collaborator was unable to read those update from the initiator.
My question is: after the initiator pushed new number to the array, how can it notify the server to make update on the server?
Thanks in advance.
Alex