yorkie-js-sdk
yorkie-js-sdk copied to clipboard
Support node.js
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.
import xhr2 from "xhr2"; global.XMLHttpRequest = xhr2;
and it works...
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-web
usesXMLHttpRequest
, 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.
Related to https://github.com/yorkie-team/yorkie/issues/668