Skip to content

websocket custom Headers? #5203

Description

@IDONTSUDO

Custom Headers? Rxjs websocket

Its not work`s


import { isAuthenticated} from "../Api/Auth"
import { webSocket } from "rxjs/webSocket";


const jwt = isAuthenticated().token
const JSONjwt = JSON.stringify(jwt)

let wsOnline = new webSocket(url: "ws:localhost:4041/online", protocol: [`${jwt}`])

or

  let wsOnline = new webSocket('ws:localhost:4041/online', `${jwt}`)
  wsOnline.subscribe();

How do I set custom headers?

req.header

 host: 'localhost:4041',
  connection: 'Upgrade',
  pragma: 'no-cache',
  'cache-control': 'no-cache',
  'user-agent':
   'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36',
  upgrade: 'websocket',
  origin: 'http://localhost:3001',
  'sec-websocket-version': '13',
  'accept-encoding': 'gzip, deflate, br',
  'accept-language': 'ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7',
  cookie:
   '__utma=111872281.783306218.1576685790.1576685790.1576685790.1; __utmz=111872281.1576685790.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)',
  'sec-websocket-key': '6oN0B0JnlHAAp3sYFopH0A==',
  'sec-websocket-extensions': 'permessage-deflate; client_max_window_bits' }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions