本文介绍了无法识别的 WebSocket 连接选项`agent`、`perMessageDeflate`、`pfx`、`key`、`passphrase`...你是想把这些放在`headers`下吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您是否曾在使用 WebSocket(来自socket.io-client"的 SocketIOClient)的 React Native 应用程序中遇到此消息?...

Have you ever met this message in a React Native application using a WebSocket ( SocketIOClient from 'socket.io-client') ?...

Unrecognized WebSocket connection option(s) `agent`, `perMessageDeflate`, `pfx`, `key`, `passphrase`, `cert`, `ca`, `ciphers`, `rejectUnauthorized`. Did you mean to put these under `headers`?

推荐答案

消除错误的一种方法:

let socket = io.connect(SOCKET_URL, {
  timeout: 10000,
  jsonp: false,
  transports: [‘websocket’],
  autoConnect: false,
  agent: ‘-’,
  path: ‘/’, // Whatever your path is
  pfx: ‘-’,
  key: token, // Using token-based auth.
  passphrase: cookie, // Using cookie auth.
  cert: ‘-’,
  ca: ‘-’,
  ciphers: ‘-’,
  rejectUnauthorized: ‘-’,
  perMessageDeflate: ‘-’
});

这篇关于无法识别的 WebSocket 连接选项`agent`、`perMessageDeflate`、`pfx`、`key`、`passphrase`...你是想把这些放在`headers`下吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 01:59