yorkie-js-sdk icon indicating copy to clipboard operation
yorkie-js-sdk copied to clipboard

Support node.js

Open hackerwins opened this issue 2 years ago • 4 comments

Description:

General JS SDK supports not only Browser but also NodeJS(For example, Firebase JS SDK works well with NodeJS: Link).

However, the Yorkie JS SDK has yet to implement support for browsers only. Let's make it work well in NodeJS as well.

Why:

  • Users using NodeJS can also use Yorkie.

hackerwins avatar Jul 17 '22 13:07 hackerwins

import xhr2 from "xhr2"; global.XMLHttpRequest = xhr2;

and it works...

CharlesSampson44 avatar Sep 13 '22 17:09 CharlesSampson44

I've done some research and it looks like xhr2 could be a way to use yorkie-js-sdk in node.js, but it's not a clean way because the yorkie-js-sdk needs to verify that you are in a node environment and set the xhr2 shim.

Also grpc-webusesXMLHttpRequest, so I don't think we'll be able to support it anytime soon.

So, I think using connect-web(#375) instead of grpc-web is better way.

blurfx avatar Jul 22 '23 07:07 blurfx

Related to https://github.com/yorkie-team/yorkie/issues/668

hackerwins avatar Jan 10 '24 06:01 hackerwins