feathersjs-ecosystem / socketio

[MOVED] The Feathers Socket.io websocket transport plugin
https://github.com/feathersjs/feathers
MIT License
37 stars 14 forks source link

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

Closed brewsoftware closed 7 years ago

brewsoftware commented 8 years ago

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

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 commented 7 years ago

May be a duplicate relating to webpack/socket.IO

https://github.com/socketio/socket.io/issues/2109

Currently looking through for a solution.

daffl commented 7 years ago

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.