2017-09-20 1 views
2

Je crée un projet en utilisant Twilio dans React natif 0.46.4 suivant leur exemple: https://github.com/twilio/TwilioChatJsReactNativeTwilsock E: 'protocole non pris en charge: Mb u000bHà U0001] aD r ver undefined'

Bien que, un relances d'erreur étranges lors de l'initialisation de l'API:

import { Client as TwilioChatClient } from "twilio-chat"; 
import { AccessManager as TwilioAccessManager } from "twilio-common"; 

const client = new TwilioChatClient(TOKEN, { logLevel: "debug" }); 
const accessManager = new TwilioAccessManager(TOKEN); 

client.initialize().then(() => (
    client.getSubscribedChannels().then(() => { 
    // ... 
    }) 
)); 

Ceci est le résultat: Neact Native error

Et enfin le journal:

2.195 I: 'Twilsock D:', 'FSM: ', 'startup', ': ', 'none', '>>', 'disconnected' 
2.197 I: 'Twilsock D:', 'try to connect to:', 'wss://tsock.twilio.com/v3/wsconnect' 
2.199 I: 'Twilsock D:', 'FSM: ', 'userConnect', ': ', 'disconnected', '>>', 'connecting' 
2.216 W: Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue on Android as it keeps the timer module awake, and timers can only be called when the app is in the foreground. See https://github.com/facebook/react-native/issues/12981 for more info. 
2.216 W: (Saw setTimeout with duration 3419784ms) 
2.217 W: Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue on Android as it keeps the timer module awake, and timers can only be called when the app is in the foreground. See https://github.com/facebook/react-native/issues/12981 for more info. 
2.217 W: (Saw setTimeout with duration 3599783ms) 
2.244 I: 'EMS D:', 'Token request', { fpa_token: 'xxxx', 
2.244 I: continuation_token: undefined } 
2.247 I: 'Chat I:', 'updateToken' 
3.096 I: 'EMS D:', 'Token response:', { status: 200, 
3.096 I: headers: 
3.096 I: { 'content-type': 'application/json;charset=utf-8', 
3.096 I:  date: 'Wed, 20 Sep 2017 20:09:53 GMT', 
3.096 I:  server: 'nginx', 
3.096 I:  'strict-transport-security': 'max-age=15768000', 
3.096 I:  'x-shenanigans': 'none', 
3.096 I:  'content-length': '1695', 
3.096 I:  connection: 'keep-alive' }, 
3.096 I: body: 
3.096 I: { twilio_rtd_token: 'yyy', 
3.096 I:  continuation_token: 'zzz', 
3.096 I:  ttl: 3599, 
3.096 I:  endpoint_ids: { chat: 'twi1-qqq' }, 
3.096 I:  status: 
3.096 I:  { status: 'NEW', 
3.096 I:   reason: 'continuation token has not been provided' }, 
3.096 I:  identity: '-----', 
3.096 I:  account_sid: 'ACxxx', 
3.096 I:  instance_sids: { chat: 'ISxxx' } } } 
3.100 I: 'Sync D:', 'POST', 'https://cds.twilio.com/v3/Lists', 'ID:', 'RQYYY' 
3.103 I: 'Twilsock I:', 'socket opened' 
3.103 I: 'Twilsock D:', 'send request:', 'TWILSOCK V3.0 557\r\n{"id":"511c7f9exxxx","method":"init","token":"yyy","payload_size":0}\r\n' 
3.105 I: 'Twilsock D:', 'FSM: ', 'socketConnected', ': ', 'connecting', '>>', 'initialising' 
3.299 E: 'Twilsock E:', 'unsupported protocol: Mb\u000bHà�\u0001]ÀÐ\r ver undefined' 
3.302 W: 'Twilsock W:', 'FSM: unexpected transition', { '0': 'socketClosed', 
3.302 W: '1': 'unsupported', 
3.302 W: '2': 'unsupported', 
3.302 W: '3': [], 
3.302 W: '4': 100, 
3.302 W: '5': 'event socketClosed inappropriate in current state unsupported' } 
3.302 I: 'Twilsock D:', 'FSM: ', 'unsupportedProtocol', ': ', 'initialising', '>>', 'unsupported' 
4.225 I: 'Sync D:', 'Establishing intent to subscribe to SHvvv' 
4.226 I: 'Chat I:', 'Session created', 'SHnnn' 
4.226 I: 'Sync D:', 'GET', 'https://cds.us1.twilio.com/v3/Services/ISzzz/Lists/SHxxx/Context', 'ID:', 'RQxxx' 
4.357 I: 'Sync D:', 'Twilsock connection (required for subscription) not ready; waiting…' 

package.json

"twilio-chat": "^1.2.0", 
"twilio-common": "^0.1.7", 
"twilio-ems-client": "^0.2.6", 
"twilio-notifications": "^0.4.4", 
"twilio-sync": "^0.5.10", 
"twilio-transport": "^0.1.3", 
"twilsock": "^0.3.5" 

Cela vient de simulateur Android. Est-ce que quelqu'un sait ce qui est possible ou ce que je fais de mal?

EDIT: fonctionne parfaitement sur iOS

Répondre

0

j'ai pu résoudre le bug en mettant à jour juste RN à 0.48.4 qui ont quelques corrections WebSocket.

+0

J'ai le même problème mais le changement de RN à 0.48.4 ne l'a pas résolu. Des idées? –

+0

Avez-vous nettoyé le cache du packager et également la build? @ArdaKeskiner –

+0

Oui, mais cela n'a pas aidé. J'ai réussi à résoudre le problème en changeant la version de core-js de 2.5.3 à 2.5.2 –