stomp-js / stompjs

Javascript and Typescript Stomp client for Web browsers and node.js apps
Apache License 2.0
742 stars 80 forks source link

Stompjs works only in debug mode react-native #149

Closed ishraqe closed 4 years ago

ishraqe commented 4 years ago
 `const client = new Client({
      brokerURL: url
      orceBinaryWSFrames: true,
      appendMissingNULLonIncoming: true,
      logRawCommunication: true,
      reconnectDelay: 0, // disable auto reconnect
      debug: str => {
       console.warn(str);
     }
 });

` im using RN version: 0.59.9 and stompjs version : ^5.4.2

when the simulator is in debug mode the client gets connected otherwise nothing.

kum-deepak commented 4 years ago

Please see https://stomp-js.github.io/workaround/stompjs/rx-stomp/ng2-stompjs/2019/06/10/react-native-null-chopping-issue.html

Let me know if it helps.

kum-deepak commented 4 years ago

Which broker are you using?

kum-deepak commented 4 years ago

Please confirm the config param name orceBinaryWSFrames, should be forceBinaryWSFrames

ishraqe commented 4 years ago

Please confirm the config param name orceBinaryWSFrames, should be forceBinaryWSFrames

i tried with that but no luck

kum-deepak commented 4 years ago

Please attach your log output. Also let me know which broker are you using?

ishraqe commented 4 years ago

I'm using spring WebSocket as broker

2019-08-18 23:18:18.254495+0800 SpeedHome[6979:218021] Warning: ListView is deprecated and will be removed in a future release. See https://fb.me/nolistview for more information 2019-08-18 23:18:18.310923+0800 SpeedHome[6979:217996] [] nw_socket_handle_socket_event [C8.1:1] Socket SO_ERROR [61: Connection refused] 2019-08-18 23:18:18.316690+0800 SpeedHome[6979:217996] [] nw_socket_handle_socket_event [C8.2:1] Socket SO_ERROR [61: Connection refused] 2019-08-18 23:18:18.318880+0800 SpeedHome[6979:218004] [] nw_connection_get_connected_socket [C8] Client called nw_connection_get_connected_socket on unconnected nw_connection 2019-08-18 23:18:18.465 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-fetch-blob/index.js -> node_modules/react-native-fetch-blob/polyfill/index.js -> node_modules/react-native-fetch-blob/polyfill/Blob.js -> node_modules/react-native-fetch-blob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:18.464771+0800 SpeedHome[6979:218021] Require cycle: node_modules/react-native-fetch-blob/index.js -> node_modules/react-native-fetch-blob/polyfill/index.js -> node_modules/react-native-fetch-blob/polyfill/Blob.js -> node_modules/react-native-fetch-blob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.479 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-fetch-blob/index.js -> node_modules/react-native-fetch-blob/polyfill/index.js -> node_modules/react-native-fetch-blob/polyfill/XMLHttpRequest.js -> node_modules/react-native-fetch-blob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.479546+0800 SpeedHome[6979:218021] Require cycle: node_modules/react-native-fetch-blob/index.js -> node_modules/react-native-fetch-blob/polyfill/index.js -> node_modules/react-native-fetch-blob/polyfill/XMLHttpRequest.js -> node_modules/react-native-fetch-blob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.481 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-fetch-blob/index.js -> node_modules/react-native-fetch-blob/polyfill/index.js -> node_modules/react-native-fetch-blob/polyfill/FileReader.js -> node_modules/react-native-fetch-blob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.481121+0800 SpeedHome[6979:218021] Require cycle: node_modules/react-native-fetch-blob/index.js -> node_modules/react-native-fetch-blob/polyfill/index.js -> node_modules/react-native-fetch-blob/polyfill/FileReader.js -> node_modules/react-native-fetch-blob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.482 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-fetch-blob/index.js -> node_modules/react-native-fetch-blob/polyfill/index.js -> node_modules/react-native-fetch-blob/polyfill/Fetch.js -> node_modules/react-native-fetch-blob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.481944+0800 SpeedHome[6979:218021] Require cycle: node_modules/react-native-fetch-blob/index.js -> node_modules/react-native-fetch-blob/polyfill/index.js -> node_modules/react-native-fetch-blob/polyfill/Fetch.js -> node_modules/react-native-fetch-blob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.617 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/utils/apps.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.616703+0800 SpeedHome[6979:218021] Require cycle: node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/utils/apps.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.619 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/admob/index.js -> node_modules/react-native-firebase/dist/modules/admob/Interstitial.js -> node_modules/react-native-firebase/dist/modules/admob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.618679+0800 SpeedHome[6979:218021] Require cycle: node_modules/react-native-firebase/dist/modules/admob/index.js -> node_modules/react-native-firebase/dist/modules/admob/Interstitial.js -> node_modules/react-native-firebase/dist/modules/admob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.619 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/admob/index.js -> node_modules/react-native-firebase/dist/modules/admob/RewardedVideo.js -> node_modules/react-native-firebase/dist/modules/admob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.619529+0800 SpeedHome[6979:218021] Require cycle: node_modules/react-native-firebase/dist/modules/admob/index.js -> node_modules/react-native-firebase/dist/modules/admob/RewardedVideo.js -> node_modules/react-native-firebase/dist/modules/admob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.626 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/database/Reference.js -> node_modules/react-native-firebase/dist/utils/SyncTree.js -> node_modules/react-native-firebase/dist/modules/database/Reference.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.625932+0800 SpeedHome[6979:218021] Require cycle: node_modules/react-native-firebase/dist/modules/database/Reference.js -> node_modules/react-native-firebase/dist/utils/SyncTree.js -> node_modules/react-native-firebase/dist/modules/database/Reference.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.627 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/core/firebase.js -> node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/modules/database/index.js -> node_modules/react-native-firebase/dist/modules/core/firebase.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.627127+0800 SpeedHome[6979:218021] Require cycle: node_modules/react-native-firebase/dist/modules/core/firebase.js -> node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/modules/database/index.js -> node_modules/react-native-firebase/dist/modules/core/firebase.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.629 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.629613+0800 SpeedHome[6979:218021] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.630 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/CollectionReference.js -> node_modules/react-native-firebase/dist/modules/firestore/Query.js -> node_modules/react-native-firebase/dist/modules/firestore/QuerySnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentChange.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/CollectionReference.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.630083+0800 SpeedHome[6979:218021] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/CollectionReference.js -> node_modules/react-native-firebase/dist/modules/firestore/Query.js -> node_modules/react-native-firebase/dist/modules/firestore/QuerySnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentChange.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/CollectionReference.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.631 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.630909+0800 SpeedHome[6979:218021] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.632 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js -> node_modules/react-native-firebase/dist/modules/firestore/FieldValue.js -> node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.631817+0800 SpeedHome[6979:218021] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js -> node_modules/react-native-firebase/dist/modules/firestore/FieldValue.js -> node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.634 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/core/firebase.js -> node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/modules/functions/index.js -> node_modules/react-native-firebase/dist/modules/core/firebase.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.634225+0800 SpeedHome[6979:218021] Require cycle: node_modules/react-native-firebase/dist/modules/core/firebase.js -> node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/modules/functions/index.js -> node_modules/react-native-firebase/dist/modules/core/firebase.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.641 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/storage/index.js -> node_modules/react-native-firebase/dist/modules/storage/reference.js -> node_modules/react-native-firebase/dist/modules/storage/task.js -> node_modules/react-native-firebase/dist/modules/storage/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.640826+0800 SpeedHome[6979:218021] Require cycle: node_modules/react-native-firebase/dist/modules/storage/index.js -> node_modules/react-native-firebase/dist/modules/storage/reference.js -> node_modules/react-native-firebase/dist/modules/storage/task.js -> node_modules/react-native-firebase/dist/modules/storage/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 2019-08-18 23:18:20.706 [info][tid:com.facebook.react.JavaScript] Running application "SpeedHome" with appParams: {"rootTag":1,"initialProps":{}}. DEV === true, development-level warning are ON, performance optimizations are OFF 2019-08-18 23:18:20.706285+0800 SpeedHome[6979:218021] Running application "SpeedHome" with appParams: {"rootTag":1,"initialProps":{}}. DEV === true, development-level warning are ON, performance optimizations are OFF 2019-08-18 23:18:20.785 [warn][tid:com.facebook.react.JavaScript] Warning: NetInfo has been extracted from react-native core and will be removed in a future release. It can now be installed and imported from '@react-native-community/netinfo' instead of 'react-native'. See https://github.com/react-native-community/react-native-netinfo 2019-08-18 23:18:20.784840+0800 SpeedHome[6979:218021] Warning: NetInfo has been extracted from react-native core and will be removed in a future release. It can now be installed and imported from '@react-native-community/netinfo' instead of 'react-native'. See https://github.com/react-native-community/react-native-netinfo 2019-08-18 23:18:20.813 [info][tid:main][RNGestureHandlerManager.m:135] [GESTURE HANDLER] Initialize gesture handler for root view <RCTRootContentView: 0x7ff70af06000; reactTag: 1; frame = (0 0; 375 812); gestureRecognizers = <NSArray: 0x600001617db0>; layer = <CALayer: 0x600001853d00>> 2019-08-18 23:18:20.813381+0800 SpeedHome[6979:217407] [GESTURE HANDLER] Initialize gesture handler for root view <RCTRootContentView: 0x7ff70af06000; reactTag: 1; frame = (0 0; 375 812); gestureRecognizers = <NSArray: 0x600001617db0>; layer = <CALayer: 0x600001853d00>> 2019-08-18 23:18:20.859 [info][tid:com.facebook.react.JavaScript] '222222', null 2019-08-18 23:18:20.859302+0800 SpeedHome[6979:218021] '222222', null 2019-08-18 23:18:20.930 [info][tid:com.facebook.react.JavaScript] { message: 'remote notifications are not supported in the simulator', details: { NSLocalizedDescription: 'remote notifications are not supported in the simulator' }, code: 3010 }, '--' 2019-08-18 23:18:20.930725+0800 SpeedHome[6979:218021] { message: 'remote notifications are not supported in the simulator', details: { NSLocalizedDescription: 'remote notifications are not supported in the simulator' }, code: 3010 }, '--' 2019-08-18 23:18:20.933 [info][tid:com.facebook.react.JavaScript] Check 2019-08-18 23:18:20.933355+0800 SpeedHome[6979:218021] Check 2019-08-18 23:18:23.815 [info][tid:com.facebook.react.JavaScript] 'URL', null, 'http://alpha.speedrent.com/mobile/chat?token=null&uid=null' 2019-08-18 23:18:23.815016+0800 SpeedHome[6979:218021] 'URL', null, 'http://alpha.speedrent.com/mobile/chat?token=null&uid=null' 2019-08-18 23:18:23.879 [warn][tid:com.facebook.react.JavaScript] Warning: Async Storage has been extracted from react-native core and will be removed in a future release. It can now be installed and imported from '@react-native-community/async-storage' instead of 'react-native'. See https://github.com/react-native-community/react-native-async-storage 2019-08-18 23:18:23.878877+0800 SpeedHome[6979:218021] Warning: Async Storage has been extracted from react-native core and will be removed in a future release. It can now be installed and imported from '@react-native-community/async-storage' instead of 'react-native'. See https://github.com/react-native-community/react-native-async-storage 2019-08-18 23:18:23.882 [info][tid:com.facebook.react.JavaScript] called 2019-08-18 23:18:23.882157+0800 SpeedHome[6979:218021] called 2019-08-18 23:18:23.896 [info][tid:com.facebook.react.JavaScript] 'URL', null, 'http://alpha.speedrent.com/mobile/chat?token=null&uid=null' 2019-08-18 23:18:23.896373+0800 SpeedHome[6979:218021] 'URL', null, 'http://alpha.speedrent.com/mobile/chat?token=null&uid=null' 2019-08-18 23:18:23.907 [warn][tid:com.facebook.react.JavaScript] Opening Web Socket... 2019-08-18 23:18:23.906793+0800 SpeedHome[6979:218021] Opening Web Socket... 2019-08-18 23:18:23.912 [info][tid:com.facebook.react.JavaScript] 'URL', null, 'http://alpha.speedrent.com/mobile/chat?token=SZhxCqeZQJME0NcWFFzj5NjHXSFTiQIt&uid=195861' 2019-08-18 23:18:23.913001+0800 SpeedHome[6979:218021] 'URL', null, 'http://alpha.speedrent.com/mobile/chat?token=SZhxCqeZQJME0NcWFFzj5NjHXSFTiQIt&uid=195861' 2019-08-18 23:18:24.013 [warn][tid:com.facebook.react.JavaScript] Possible Unhandled Promise Rejection (id: 0): ReferenceError: Can't find variable: TextEncoder Parser@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:269393:44 start@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:269703:45 http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:268765:45 step@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:268577:31 fulfilled@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:268459:36 tryCallOne@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:3162:16 http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:3263:27 _callTimer@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:27768:17 _callImmediatesPass@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:27804:19 callImmediates@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:28023:33 callImmediates@[native code] callImmediates@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:2564:35 http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:2385:34 guard@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:2547:15 flushedQueue@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:2384:21 flushedQueue@[native code] callFunctionReturnFlushedQueue@[native code] 2019-08-18 23:18:24.013683+0800 SpeedHome[6979:218021] Possible Unhandled Promise Rejection (id: 0): ReferenceError: Can't find variable: TextEncoder Parser@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:269393:44 start@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:269703:45 http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:268765:45 step@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:268577:31 fulfilled@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:268459:36 tryCallOne@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:3162:16 http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:3263:27 _callTimer@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:27768:17 _callImmediatesPass@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:27804:19 callImmediates@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:28023:33 callImmediates@[native code] callImmediates@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:2564:35 http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:2385:34 guard@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:2547:15 flushedQueue@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:2384:21 flushedQueue@[native code] callFunctionReturnFlushedQueue@[native code] 2019-08-18 23:18:30.193483+0800 SpeedHome[6979:217997] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C15.1:2][0x7ff70ac7de20] get output frames failed, state 8196 2019-08-18 23:18:30.193714+0800 SpeedHome[6979:217997] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C15.1:2][0x7ff70ac7de20] get output frames failed, state 8196 2019-08-18 23:18:30.194272+0800 SpeedHome[6979:217997] TIC Read Status [15:0x0]: 1:57 2019-08-18 23:18:30.194446+0800 SpeedHome[6979:217997] TIC Read Status [15:0x0]: 1:57

kum-deepak commented 4 years ago

I am sorry at this stage, however, I do not have anything else to suggest. It seems to be a reported issue at React, this library tries to bypass that issue, but, seems it is not enough.

songxie commented 4 years ago

I have the same problem. My rn app connect rabbitmq no problem in debug mode.When I disable the debug mode,the app stop at 'Opening Web Socket...' .

kum-deepak commented 4 years ago

Please see https://stomp-js.github.io/workaround/stompjs/rx-stomp/ng2-stompjs/2019/06/10/react-native-null-chopping-issue.html

kum-deepak commented 4 years ago

Try the 2nd workaround first if you are using RabbitMQ.

songxie commented 4 years ago

@kum-deepak Not work for me.

kum-deepak commented 4 years ago

Sorry, but until the underlying issue gets fixed in React Native, unable to help further.

songxie commented 4 years ago

I got it. React Native doesn't support TextEncoder() method. So, the code stop at Parser init.

kum-deepak commented 4 years ago

That indeed maybe the issue. Have tried to use TextEncoder polyfill?

Earlier NodeJS needed this, you can see the instruction for NodeJS at https://stomp-js.github.io/guide/stompjs/rx-stomp/ng2-stompjs/2018/06/29/pollyfils-for-stompjs-v5.html.

Depending on your project setup you may need to convert require to import. Please let me know it you need any assistance.

If it works, I will add this to the instructions.

songxie commented 4 years ago

It works! My steps:

1. npm install text-encoding --save
2.import * as encoding from 'text-encoding';  in my RN project.

Thanks! @kum-deepak

kum-deepak commented 4 years ago

Thanks @songxie, I will update the documentation.

mattruddy commented 4 years ago

@songxie where did you put import * as encoding from 'text-encoding';

within the project, I am also facing the same issue, it's driving me insane =P

IliRusli commented 4 years ago

@mattruddy did you found where to put it? I also faced the same problem.

@kum-deepak can you explain more the usage of text-encoding in react-native. Which part should we encode/decode?

vipulchasta commented 4 years ago

@IlifilzaRusli @mattruddy You can add import statement in your index.js or App.js, anything will work fine. But make sure you have done changes for forceBinaryWSFrames & appendMissingNULLonIncoming also.

And one more thing I would like to add. (For Android development) If your connection to broker is not secured(you are not using any ssl certificate) then connection will not get established. You will find following error log in production build(you can use logcat in production build) but same will work perfectly in debug build.

Screenshot 2020-05-26 at 3 37 19 AM

To overcome from this issue you will have to add following line in your android manifest file to allow unsecure traffic. android:usesCleartextTraffic="true"

Reference: https://blog.usejournal.com/6-daily-issues-in-android-cleartext-traffic-error-52ab31dd86c2

By incorporating all four changes... my app is working fine with RabbitMQ broker, even in production build. Changes are: **1. Importing TextEncoder polyfill

  1. Setting flags forceBinaryWSFrames & appendMissingNULLonIncoming to true
  2. Allowing Unsecure outgoing traffic for the app.
  3. Setting "web_stomp.ws_frame = binary" on RabbitMQ broker config [I don't think it is required. After doing all four changes I verified my app, and it was working. But I have not tried without this change]**

Thanks @kum-deepak from great documentation.

kum-deepak commented 4 years ago

Many thanks @vipulchasta! I have updated https://stomp-js.github.io/guide/stompjs/rx-stomp/ng2-stompjs/pollyfils-for-stompjs-v5.html#in-react-native and https://stomp-js.github.io/workaround/stompjs/rx-stomp/ng2-stompjs/react-native-additional-notes.html.

IliRusli commented 4 years ago

@vipulchasta thanks for the reply. For the first step Importing TextEncoder polyfill, do we have to use the imported encoding somewhere in the code or it's just an unused import?

shakyarahul commented 3 years ago

@IlifilzaRusli @mattruddy You can add import statement in your index.js or App.js, anything will work fine. But make sure you have done changes for forceBinaryWSFrames & appendMissingNULLonIncoming also.

And one more thing I would like to add. (For Android development) If your connection to broker is not secured(you are not using any ssl certificate) then connection will not get established. You will find following error log in production build(you can use logcat in production build) but same will work perfectly in debug build.

Screenshot 2020-05-26 at 3 37 19 AM

To overcome from this issue you will have to add following line in your android manifest file to allow unsecure traffic. android:usesCleartextTraffic="true"

Reference: https://blog.usejournal.com/6-daily-issues-in-android-cleartext-traffic-error-52ab31dd86c2

By incorporating all four changes... my app is working fine with RabbitMQ broker, even in production build. Changes are: 1. Importing TextEncoder polyfill 2. Setting flags forceBinaryWSFrames & appendMissingNULLonIncoming to true 3. Allowing Unsecure outgoing traffic for the app. 4. Setting "web_stomp.ws_frame = binary" on RabbitMQ broker config [I don't think it is required. After doing all four changes I verified my app, and it was working. But I have not tried without this change]

Thanks @kum-deepak from great documentation.

HOW TO DO IT IN EXPO?

orhangazi commented 2 years ago

I did the first and second steps and it work. Thank you so much.

  1. Importing TextEncoder polyfill (app.js or index.js)
  2. Setting flags forceBinaryWSFrames & appendMissingNULLonIncoming to true (add both into the stomp configure)

@IlifilzaRusli @mattruddy You can add import statement in your index.js or App.js, anything will work fine. But make sure you have done changes for forceBinaryWSFrames & appendMissingNULLonIncoming also.

And one more thing I would like to add. (For Android development) If your connection to broker is not secured(you are not using any ssl certificate) then connection will not get established. You will find following error log in production build(you can use logcat in production build) but same will work perfectly in debug build.

Screenshot 2020-05-26 at 3 37 19 AM

To overcome from this issue you will have to add following line in your android manifest file to allow unsecure traffic. android:usesCleartextTraffic="true"

Reference: https://blog.usejournal.com/6-daily-issues-in-android-cleartext-traffic-error-52ab31dd86c2

By incorporating all four changes... my app is working fine with RabbitMQ broker, even in production build. Changes are: 1. Importing TextEncoder polyfill 2. Setting flags forceBinaryWSFrames & appendMissingNULLonIncoming to true 3. Allowing Unsecure outgoing traffic for the app. 4. Setting "web_stomp.ws_frame = binary" on RabbitMQ broker config [I don't think it is required. After doing all four changes I verified my app, and it was working. But I have not tried without this change]

Thanks @kum-deepak from great documentation.

batu0b commented 6 months ago

@IlifilzaRusli @mattruddy You can add import statement in your index.js or App.js, anything will work fine. But make sure you have done changes for forceBinaryWSFrames & appendMissingNULLonIncoming also.

And one more thing I would like to add. (For Android development) If your connection to broker is not secured(you are not using any ssl certificate) then connection will not get established. You will find following error log in production build(you can use logcat in production build) but same will work perfectly in debug build.

Screenshot 2020-05-26 at 3 37 19 AM

To overcome from this issue you will have to add following line in your android manifest file to allow unsecure traffic. android:usesCleartextTraffic="true"

Reference: https://blog.usejournal.com/6-daily-issues-in-android-cleartext-traffic-error-52ab31dd86c2

By incorporating all four changes... my app is working fine with RabbitMQ broker, even in production build. Changes are: 1. Importing TextEncoder polyfill 2. Setting flags forceBinaryWSFrames & appendMissingNULLonIncoming to true 3. Allowing Unsecure outgoing traffic for the app. 4. Setting "web_stomp.ws_frame = binary" on RabbitMQ broker config [I don't think it is required. After doing all four changes I verified my app, and it was working. But I have not tried without this change]

Thanks @kum-deepak from great documentation.

I followed the steps and I still get Connection closed problem when I send request for http could you help me

Kretiss commented 3 months ago

In my case I needed encoding in global js object

import * as encoding from 'text-encoding';
Object.assign(global, encoding);
iib0011 commented 4 weeks ago

place this inside index.js or App.jsx


import {TextEncoder} from 'text-encoding';

global.TextEncoder = TextEncoder;