flutter - Flutter:如何向 websockets sink.add 添加标头
问题描述
大家好,我使用 websocket_channel 库进行颤动,当我连接时,我得到一个 live_id,我将发送到服务器的进一步消息需要该 id,我以这种方式连接到数据库:
channel = New IOWebSocketChannel.connection('ws://host.com/',headers: headers);
假设要断开连接,我需要发送一个 json 正文
{
type: 2,
id: 1
}
而且我还需要在标题中传递live_id,我该怎么做?
解决方案
推荐阅读
- php - 在表单中验证 ReCapatcha?
- java - JMH 测试产生大量“中断”消息
- tensorflow - 我的 Pytorch 模型给出了非常糟糕的结果
- node.js - 从服务器内部访问不同服务器上的路由(Express)
- python - Python 雨量计,纠正误报
- laravel - 尝试在 null 上读取属性“degree”
- javascript - 如何访问 Javascript 中数组内的数组内的元素?
- oracle - 触发器中的行的 SUM()(PL/SQL)
- ios - 检查 SwiftUI 中是否存在自定义字体
- firebase-authentication - Firebase createCustomToken() 在本地模拟器中返回无效令牌