Skip to content

how to connect to localhost Meteor app #82

@jankapunkt

Description

@jankapunkt

I am using expo and I am trying to connect to a Meteor app on localhost in dev mode (expo start; bundle is pushed to my real android phone, no emulator)

Meteor.connect('ws://localhost:8080/websocket')
Meteor.getData().ddp.socket.rawSocket.onerror = e => console.error(e);
Meteor.getData().ddp.socket.addListener("open", () => console.log("open"));
Meteor.getData().ddp.socket.addListener("close", () => console.log("close"));

which produces the following output:

close
close

Event {
  "isTrusted": false,
  "message": "Failed to connect to localhost/127.0.0.1:8080",
}
at meteor/connect.js:12:2 in connectMeteor
at node_modules/react-native/Libraries/WebSocket/WebSocket.js:258:8 in _eventEmitter.addListener$argument_1
at node_modules/react-native/Libraries/vendor/emitter/_EventEmitter.js:135:10 in EventEmitter#emit

Dependencies:

    "@babel/preset-react": "^7.16.0",
    "@expo/vector-icons": "^12.0.5",
    "@meteorrn/core": "^2.3.0",
    "@react-native-community/netinfo": "^7.1.7",
    "@react-navigation/native": "^6.0.6",
    "@react-navigation/native-stack": "^6.2.5",
    "@react-navigation/stack": "^6.0.11",
    "babel-preset-es2015": "^6.24.1",
    "colors": "1.4.0",
    "expo": "~43.0.3",
    "expo-app-loading": "^1.2.1",
    "expo-font": "~10.0.3",
    "expo-speech": "~10.0.3",
    "expo-splash-screen": "~0.13.5",
    "i18next": "^21.5.4",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-i18next": "^11.14.3",
    "react-native": "^0.64.3",
    "react-native-elements": "^3.4.2",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-safe-area-context": "3.3.2",
    "react-native-screens": "~3.8.0",
    "react-native-tts": "^4.1.0",
    "react-native-vector-icons": "^9.0.0",
    "react-native-web": "~0.17.5"

Is this expected; did I do something wrong here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions