tmijs / tmi.js

💬 Javascript library for the Twitch Messaging Interface. (Twitch.tv)
https://tmijs.com
MIT License
1.56k stars 211 forks source link

Cannot read property 'connection' of undefined in client.connect() #97

Closed xingped closed 8 years ago

xingped commented 8 years ago

Actual behaviour: Using node-webkit v0.12.3 (Chromium 41.0.2272.76), when trying to use client.connect() after creating the client object with a set of options, an error is thrown - "Cannot read property 'connection' of undefined"

Expected behaviour: IRC client should connect without error

Error log:

var irc = require('tmi.js');
$scope.client = new irc.client({
    options: {
        debug: true
    },
    identity: {
        username: $scope.username,
        password: $scope.password
    },
    channels: [$scope.channel]
});
$scope.client.connect().then(function(data){
    console.log('connection data...');
    console.log(data);
}).catch(function(err){
    console.log('connection error...');
    console.log(err);
});

...
connection error...
Cannot read property 'connection' of undefined

Server configuration

xingped commented 8 years ago

I've considered the possibility that it's some sort of ECMA 6 problem because I had to actually edit your source to remove all the instances of the () => {} function syntax because nwjs v0.12.3's version of chromium isn't fully compatible with ECMA 6 yet. I can't seem to find any ECMA 6 functionality that could otherwise be causing this problem, but it's a thought I had.

Schmoopiie commented 8 years ago

Could be, I will investigate this issue and see what I can do, I use Electron and I have no problem with ES6 or whatsoever, I will give node-webkit a try this week and see what's going on.

Thanks!

Schmoopiie commented 8 years ago

I can't believe that I forgot to test this issue.. is it still an issue for you @xingped ? Like I said, I know for a fact that tmi.js works fine with Electron..

xingped commented 8 years ago

Haha, I forgot about it too! I actually did switch my project over to Electron a couple weeks ago and it worked perfectly without any modifications. Electron just seems a lot nicer than node-webkit anyways and doesn't crash as much. So it isn't an issue for me anymore!

Schmoopiie commented 8 years ago

Awesome :+1: Yeah it's a lot better :smile: