Closed mununki closed 4 years ago
Can you give me a little more detail of what you mean by "no gain"? I would expect something like this to work:
[@bs.module "ws"]
external ws: ApolloClient.Link.WebSocketLink.webSocketImpl = "default";
let wsLink =
ApolloClient.Link.WebSocketLink.make(~uri="wss://yourendpoint.com", ~webSocketImpl=ws, ());
Are you getting a type error or what exactly is the error you're encountering?
I haven't looked at bs-ws
, but if you want to use that, it will not have the same types. You'll need to cast it to ApolloClient.Link.WebSocketLink.webSocketImpl
using %identity
or Obj.magic
and then pass it in.
@jeddeloh Thank you very much, it fixes my problem. Frankly, I'm very new to ReasonML, so I'm not much experienced with @bs
decorator yet. Thank you again.
[@bs.module "ws"]
external ws: ApolloClient.Link.WebSocketLink.webSocketImpl = "default";
let wsLink =
ApolloClient.Link.WebSocketLink.(
make(
~uri="ws://" ++ graphqlEndpoint,
~options=
ClientOptions.make(
~connectionParams=ConnectionParams(Obj.magic(headers)),
~reconnect=true,
(),
),
~webSocketImpl=ws,
(),
)
);
No problem. Welcome to Reason!
Hi,
Actually, I'm trying to use this module on the ground of Gatsby. I faced the one problem which is the error in process of building the static page. I guess the
ws
is not existing in node env during building Gatsby static page.So, I tried to add
~webSocketImpl
, but no gain.Can you give me a tip to use a custom ws implementation? using JS module
ws
orbs-ws
which is binding tows
.