SvenKirschbaum / react-stomp-hooks

This repository contain a react library which enables simple access to stomp subscriptions via hooks.
MIT License
63 stars 13 forks source link

StompSessionProvider doesn't apply headers #31

Closed ChristophZipperle closed 3 months ago

ChristophZipperle commented 4 months ago

I am configuring my StompSessionPRovider like so:

      <StompSessionProvider
        url="wss://bla/ws"
        heartbeatIncoming={3000}
        heartbeatOutgoing={0}
        stompVersions={
          new Versions(["1.2"])
        }
        connectHeaders={{
          Authorization: token,
        }}
        debug={(str) => {
          console.log(str);
        }}
      >

The connection fails and when I inspect the request, I can see no heartbeat, no authorization, and no versions. The dev tools also says that "Provisional headers shown." which seems to indicate a problem with the headers. It tries to connect to the correct URL tho, which is passed along with the headers. Any idea what I am doing wrong?

SvenKirschbaum commented 4 months ago

Hello!

"Provisional headers shown" usually means that the request you are inspecting wasn't actually sent for some reason. My gut feeling is that your issue is probably caused by CORS. Please provide a Screenshot of the Inspect view of the request, as well as of any console output that may have occurred when connecting.