alaingilbert / Turntable-API

Allows you to create bots for turntable.fm
http://alaingilbert.github.com/Turntable-API/
MIT License
317 stars 97 forks source link

bot.connect / room.register does not have section #183

Open Izzmo opened 11 years ago

Izzmo commented 11 years ago

I have noticed that if you try to connect right now, it will always try and connect to section 0 of a room, full or not. If there is another section, it will not try to connect to it.

The poses a couple problems:

  1. There is nothing in place to try and reconnect to a different section.
  2. When connecting to a different section other than 0, the whichServer method no longer works since it was not written with sections in mind, so you will get a wrong chat server, potentially. In my case, the chat server has always been wrong.

The only way around this is probably to parse the error message (unless there is an appropriate API call), and get the chat server that way for the section and then reconnect using it.

I have some code written, but I'm not sure if anyone really needs it or not, as most people will not have to deal with multiple sections when joining a room, and/or would not want to join a section other than the main one.

alaingilbert commented 11 years ago

I wasn't even aware of the "sections" ! You should create a branch with what you have. I'll try to help !

Izzmo commented 11 years ago

I am still testing some things out. I was speaking with Frick last night about it, and it looks like his "room.which_server" API call does support sections, but if you try to join a section which is already full, you get an Error Message 4: Room Is full, so then you would have to increase the section by 1 and attempt to join that room.

Unfortunately, in some cases, rooms don't have another section available you get an error 5: Section not found.

In that last case, which happened and is still happening a lot, a bot is unable to join the section and you get a "wrong chat server" error, and it will redirect you to another chat server and room, which you must parse. I am currently working on this.

Izzmo commented 11 years ago

Quick update: looks like in the process of working through this, Frick & I found a potential security risk with sections and joining section 0 (which apparently is not the main room, but a section that does not actually exist). So, he patched that up, and now I think I have commitable code for this.

Izzmo commented 11 years ago

I am going to wait until another large >300+ event happens to confirm this is all well and working.

alaingilbert commented 11 years ago

ok :)

Izzmo commented 11 years ago

So, just a quick update. I haven't really been able to test this lately since Turntable.fm's global numbers have been down and no rooms have even gone over 200 daily right now.

There were a few problems I was running into with getting a correct response back from Turntable.fm on the whichServer method.

Side note: Now that Frick is gone from Turntable.fm, it might be a little harder to ask technical questions about their code :frowning: