Initial Rackmate implementation
Lua-CJSON
Mac OS X GUI wrapper
Communicate with Lua thread via websocket
Fix websocket.broadcast()
Check if notify is called on same thread as Lua runs

Not just main thread. Also this is portable. We will use pthread-win32 as well so…

The reason for this code is libspotify sometimes asks for notify_main_thread to occur ON the main thread :P Our startup sequence means Spotify initializes before we call listen() on the socket, which means our blocking tellmate() holds up startup for > 5 seconds waiting for nothing.
Save WebSocket protocol from handshake
Cleaner main()
Fix os.mkpath
If process_events returns timeout 0, run again

As per libspotify examples.
Remove SIGINT and at exit handler

We should only logout during a controlled exit. SIGINT breaks the select connection, and also we shouldn't do complicated things in the signal handler itself (apparently), there were a lot of issues in this code that I was finding.
Start Spotify after we listen on our socket

Otherwise it breaks libspotify apparently, to not notify the main thread those two times. Odd. Don’t get it. But this fixes it. Yay for programming by coincidence.