I got TypeError: Object is not async iterable error while trying to listen to message event in React Native app

オープン
#150 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
javascript, react-native, typescript

調査の方向性

Issue にはリポジトリのファイルもテストもないため、まずドキュメント化された subscribe API と listener API を、示されている React Native コードと比較します。Subscription を再現し、async-iterable エラーなしで channel がメッセージを受信できるようにするには何を変更する必要があるかを特定します。

索引モデルが issue の本文から書いたものです。

説明

Hi I am working on a React Native app and I have setup socketcluster websocket and I was able to connect to it from the app because I exposed the port of the websocket running locally on my PC with ngrok, but when I tried to listen to message events from the socket I keep getting TypeError: Object is not async iterable error in the command line and the app could not get any message from the socket

this is the code for listening to message event according to the documentation

try {
      for await (let data of this.socket_channel) {
                console.log('listenForData::: I got data from socket:::', data);
       }            
} catch (error) {
            console.log('socket message conn err', error);            
}

the socket initialization

this.websocket_instance = new SocketCluster.create({
  hostname: 'x.tcp.xx.ngrok.io',
  port: xxxxx
})

this.socket_channel = this.websocket_instance.subscribe(channel_name)
        
await this.socket_channel.listener('subscribe').once()

this.socket_channel.transmitPublish('hello from mobile phone')

the websocket connects successfully but I can't subscribe to message event and I can't get message from the socket

please is there any other ways I can subscribe to message event from the websocket except from using the for await (let data of this.socket_channel) { way, please help

主要言語
JavaScript
スター
300
フォーク
90
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

SocketCluster/socketcluster-client のほかの issue

SocketCluster/socketcluster-client の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。