Sharath
Sharath

Reputation: 21

Add extra headers in feathers socket from feathers client

I have a feathers client in reactjs which uses mostly socket connections which is inturn integrated into an iframe. I am supposed to send the parent url from feathers client to my backend.

for instance, my feathers client is running on abc.com , and xyz.com is integrating abc.com in an iframe. I am supposed to get xyz.com in feathers socket object or pass the parent domain as extra headers to my feathers server.

Upvotes: 0

Views: 1766

Answers (1)

Daff
Daff

Reputation: 44215

Extra headers can be passed when initializing the Socket.io client through the extraHeaders options:

const socket = io({
  transportOptions: {
    polling: {
      extraHeaders: {
        'x-clientid': 'abc'
      }
    }
  }
});

Upvotes: 2

Related Questions