Getting socket.io v1.x.x to Work on Heroku

Many outdated tutorials will tell you that you need to add the below code to your server in order for socket.io code to work.

1
2
3
4
io.configure(function () {
    io.set("transports", ["xhr-polling"]);
    io.set("polling duration", 10);
});

However, in newer versions of socket.io (v1.x.x), the set() and configure() methods are deprecated, as outlined here, and they result in the error “io.configure is not a function”. Instead, you should pass in the settings when you initialize the instance, like this:

1
2
3
4
var io = require('socket.io')({
    "transports" : ["xhr-polling"],
    "polling duration" : 10
}).listen(server);

Also, in your client code you should use the “ws” protocol instead of “http” when trying to connect.

That should be all you need to get your app running!

Unit Testing With OpenFrameworks in XCode

I had to struggle unnecessarily to set up unit testing with an OpenFrameworks project in Xcode. If you are impatient like me and don’t mind a bit of a hacky solution here are the steps I used.

Maven ‘the Forked VM Terminated Without Saying Properly Goodbye’ Error

I recently got this error while building a project in IntelliJ. It turns out the problem was related to improper capitalization of import statements in some of the files. If you get this error, try running the build with -x or -e to pin down where it is coming from and see if changing the import statements helps.

House of Leaves Chrome Extension

House of Leaves” is my favorite book ever. If you haven’t read it, one thing to know about it is that every instance of the word house is highlighted in blue. I decided it would be fun to bring this into web surfing, so I made a chrome extension that does the same thing using jQuery’s highlight function. It’s a little buggy but seems to work well enough. Enjoy!