question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wampy not connecting in react-native env

See original GitHub issue

Describe the bug Wampy is not connecting properly in react-native environment.

The onConnect callback is not called.

Killing the crossbar service will trigger the onClose and onError callbacks. As mentioned also here: https://github.com/KSDaemon/wampy.js/issues/82#issuecomment-405012228

I also checked https://github.com/KSDaemon/wampy.js/issues/82 but could not find a working solution. Also the examples use w3cws as ws client.

I made a stripped down version of crossbar.io without authentication and bundled it into a repo to reproduce.

To Reproduce Clone https://github.com/zaytsevfuu/wampytest yarn install node node_modules/react-native/local-cli/cli.js run-android yarn run start cd crossbar && ./start_wamp.sh

Expected behavior onConnect callback is called

Screenshots Screenshot 2019-04-25 10 48 35

Screenshot 2019-04-25 10 52 38

Environment (please complete the following information):

  • Mac
  • see package.json
  • crossbar official docker image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:21 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
KSDaemoncommented, Jun 17, 2019

@cabelitos Thats great! Looking forward for next release with ur MR included 😃

1reaction
ephrocommented, May 12, 2019

@KSDaemon I did some more digging and I think the problem is just with react-native and android because of the OkHttp code. I don’t have mac handy to test on IOS right now, however this test should only check for the undefined protocol in RN envs, while not affecting other ones. The code below would replace 582 from the post above.

            if (serverProtocol === 'json'
                ||  (typeof navigator != 'undefined'
                    && navigator.product == 'ReactNative'
                    && typeof this._ws.protocol === 'undefined')) {

Apologies for the multi-line here, but I wanted to to fit in the post more easily.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Develop React w/ full-stack (WAMP) locally
Is it possible to just run WAMP at localhost:3000 and React yarn start at localhost:3002 (it auto-sets different IP) and then just put...
Read more >
WAMP issues, not loading config files - Laracasts
Hi, I've began noticing that after upgrading an older Laravel 4 project to 5.2 where Laravel moved to .env files to serve config...
Read more >
How to Install and Setup Apache/MySQL/PHP for Linux (LAMP ...
To start the WampServer, choose "Start WampServer" from the "Start" menu; or run " wampmanager.exe " from the WampServer installed directory. An little...
Read more >
wampy - npm
Wampy.js is javascript library, that runs both in browser and node.js enviroments, and even in react native enviroment. It implements WAMP ...
Read more >
Install and Run Laravel on Windows Wamp Server - Medium
This tutorial is only for those like me who want to use WAMP environment for Lavarel application development. We have installed the WAMP...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found