connecting to y-js

#1

I've been looking at Crossbar and Autobahn recently to see if it would be a fit for a real time collaborative application I'm building. It seems to me that if one were to hook up y-js up, this would add significantly to the capabilities as it would provide conflict resolution and offline editing capabilities. On the y-js site I noticed that it has a websockets connector... but i'm not sure how this would work with the pubsub architecture of wamp? Any ideas as to whether or not these would play nice together? Thanks in advance!

Ryan

0 Likes

#2

Hi Ryan, do you have any examples of applications that use y-js / how it’s used?

0 Likes

#3

Hi Gareth,

Yes for sure, here are some examples (http://y-js.org/#!/examples) with the source code being here (https://github.com/y-js/yjs/tree/dist/Examples). Per the main page (https://github.com/y-js/yjs) they split out three things... the connector (i.e. how communication protocol), the database, and the datatype to synchronize. All of the examples use websockets as their connector and as I understand it for websockets they have to libraries... one for the websocket server (https://github.com/y-js/y-websockets-server) and one for the client (https://github.com/y-js/y-websockets-client).

The examples provided in the first link are very neat to play with! :slight_smile:

Ryan

0 Likes

#4

Ok, looks interesting, but I was really looking for examples of applications, rather than … examples of examples / demos … if you see what I mean. It was the offline stuff in particular that sounded interesting, syncing two editors etc using Autobahn/Crossbar is relatively trivial, I’m already doing this with xterm.js sessions and codemirror sessions, this is simply a matter of using pub/sub for communication and subscribing multiple clients to the same topic. (not measured, but probably no more code than in the y-js demos) However, if there is an example of y-js doing this and providing offline sync in a real application, I’d be very interested in taking a peek.

0 Likes

#5

Yes after I had replied I thought it would be nice to see more as well, but unfortunately that's all I've been able to find thus far! :confused: I will keep looking and post any more full featured examples I find here.

Crossbar and autobahn is great (fantastic), but for simultaneous editing of documents over PubSub, still missing conflict resolution (and like you mentioned offline editing). Those issues as I understand are really both the same issue and can be solved by operational transforms or CRDT's... which is what led me to ShareDB (formerly ShareJS, made by the former google wave guy) first and then to yjs. Yjs doesn't seem to be as well used as ShareDB from what I can tell, but seems to be more modular (separation of types/connectors/database) which is what led me to try to hook it up with crossbar and autobahn. Given that YJS is using operational transforms, it seems like that all that is required is to have some local storage of the edits while offline (https://github.com/y-js/y-indexeddb)... and of course to hook it up! :slight_smile: I'm new to both though (yjs and crossbar/autobahn) so please let me know if you think I'm missing a simple reason why it won't work well! :wink:

Ryan

0 Likes

#6

Correction, I believe the algorithms used by y-js are not 'operational transforms' per se but a modification which is similar to operational transforms and shares some commonalities with WOOT.

0 Likes

#7

Hi, it’s not so much that it won’t work well, but it looks on the face of it like Yjs wants a raw websocket transport … as far as I’m concerned (as a user) Autobahn and Crossbar is really all about WAMP … which is just “different” to raw websockets and isn’t (I don’t think) going to plug in as a websocket transport. It’s not dissimilar to comparing a TCP/IP socket interface, to a HTTP connection.

If you come across a real-live use-case for Yjs, it would be interesting to see how much of the solution could be easily implemented in Autobahn/Crossbar, and how much would need to be added to duplicate the functionality …

0 Likes

#8

Thanks Gareth. Thats kind of what I was wondering.

0 Likes

#9

Thinking about websockets now, rather than WAMP, it’s a bit like writing some code to get a web page using “socket()” rather than using wget or curl … “that’s what we did yesterday …” … :wink:

0 Likes

#10

Update : I did chat with a guy who develops on y-js and he thinks it should work fine, with the following caveat:

"But there has to be a way to get the current state of the shared data. This is usually done using directed communication. I suggest to implement a server for getting the initial content. When the initial sync process is done you can send & receive updates from the pubsub."

0 Likes