fdgt-apis / api

`fdgt` is a mock API for the Twitch. Via `fdgt`, you can simulate events without having to spend a penny!
https://fdgt.dev
BSD 3-Clause "New" or "Revised" License
74 stars 7 forks source link

Issue with connecting via twitch.js #47

Open coolcalcacol opened 4 years ago

coolcalcacol commented 4 years ago

Describe the bug Using twitch.js, I get no output from the irc server except a Disconnected unexpectedly error.

To Reproduce Steps to reproduce the behavior:

const ChatClient = require('twitch-chat-client');
const client = ChatClient.anonymous({
    hostName: 'irc.fdgt.dev',
})
client.connect();

client.onJoin((channel, user) => {
    console.log("Connected");
})

client.onCommunitySub((channel, user, subInfo, msg) => {
    console.log(`${channel}, ${user}, onCommunitySub`);
})

client.onSub((channel, user, subInfo, msg) => {
    console.log(`${channel}, ${user}, onSub`);
})

client.say('#channel', 'submysterygift.tier3 --giftcount 10');
client.say('#channel', 'subscription --tier 3');

Expected behavior Using the above code, I expect 10 gifted sub events and one tier three regular subscription

thomaslule commented 4 years ago

Hi, its probably related: I cannot connect with tmi.js either.

This code outputs: Unable to connect.

const tmi = require("tmi.js");

const client = new tmi.Client({
  connection: {
    server: "irc.fdgt.dev",
  },
});

client
  .connect()
  .then(() => {
    console.log("connected");
  })
  .catch((err) => {
    console.error(err);
  });
trezy commented 4 years ago

@thomaslule If you’re using tmi on the server-side, you’ll need to add secure: true to your connection config.

const client = new tmi.Client({
  connection: {
    secure: true,
    server: "irc.fdgt.dev",
  },
});

That’s a failing of the docs that will be addressed by fdgt-apis/website#27.

thomaslule commented 4 years ago

@trezy oh thanks that's right, sorry for the noise in this issue

trezy commented 4 years ago

@coolcalcacol I still haven't had a chance to actually verify this bug, but I've got a suspicion that you may need to set the ssl option to true when creating the connection. For example:

const client = ChatClient.anonymous({
  ssl: true,
  hostName: 'irc.fdgt.dev',
})

Let me know whether or not that solves the issue. If so, I'll update the docs.

d-fischer commented 4 years ago

ssl is the default... at least it should be.

opti21 commented 4 years ago

@d-fischer It is for Twitch, but not for custom servers you have to explicitly mark it secure. I believe it's like that for people running local IRC servers

d-fischer commented 4 years ago

Where'd you get that idea? I know the opposite is true from being the author of the library.

coolcalcacol commented 4 years ago

Suggested fix didn't work, apologies for the delay