Skip to content
This repository was archived by the owner on Aug 29, 2018. It is now read-only.

Unable to use feathers from within React (Feathers vs SocketIO implementation setup issue) #51

Closed
brewsoftware opened this issue Nov 19, 2016 · 2 comments

Comments

@brewsoftware
Copy link

Steps to reproduce

`
const io = require( 'socket.io-client/socket.io');
const feathers = require('feathers/client');
const socketio = require('feathers-socketio/client')

const socket = io('http://localhost:3030');

var client = feathers()
.configure(socketio(socket));
`

Expected behavior

Socket IO should be established and working.

When running a basic HTML only test the back end is setup correctly and working fine.

It's a little unclear in the documentation about how this should be working. Specifically I think there is an assumption that dependencies are added as global scripts and there are a number of hooks that might be clashing at that level.

Tell us what should happen

Actual behavior

Causes an exception of socketio is not a function(…)

System configuration

https://github.com/brewsoftware/hang-ten

  • cwd to the Client sub directory
  • npm install
  • npm run start

load a webpage of http://localhost:8080/

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):
"feathers": "^2.0.2",
"feathers-hooks": "^1.6.1",
"feathers-socketio": "^1.4.2",
"socket.io": "^1.5.1",
"socket.io-client": "^1.5.1",

NodeJS version: NA (Client only)

Operating System: Windows

Browser Version: Chrome

React Native Version: React web

Module Loader: Webpack

@brewsoftware brewsoftware changed the title Unable to use feathers from within React (Feathers undefined) Unable to use feathers from within React (Feathers vs SocketIO implementation setup issue) Nov 19, 2016
@brewsoftware
Copy link
Author

May be a duplicate relating to webpack/socket.IO

socketio/socket.io#2109

Currently looking through for a solution.

@daffl
Copy link
Member

daffl commented Nov 20, 2016

I just created a new app with create-react-app, installed the Feathers dependencies, updated my app.js, started and everything worked. Also, many of the Feathers starters (like this one) use Webpack with Feathers as well. Running your repository I actually got a different error (Path expected string but got undefined).

I'm going to close it since this looks more like a specific Webpack (+ potential Socket.io) configuration than a Feathers issue and I'm not sure we can be of much more help here.

@daffl daffl closed this as completed Nov 20, 2016
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants