Using SmartFoxServer with Javascript instead of c#

I am using Javascript for my project in Unity and would like to be able to connect to SFS using Javascript as well. I've been trying to convert the SFS example to Javascript, but since I have never used C# this is proving problematic. I've gotten most of the errors out, but I am still having issues with this block:

import SmartFoxClientAPI;

private var serverName : String = "127.0.0.1";
private var serverPort : int = 9339;
private var statusMessage : String = "";

function Start() {
    var smartFox : SmartFoxClient = new SmartFoxClient();
    SFSEvent.onConnection += HandleConnection;
    smartFox.Connect(serverName, serverPort);
}

I get the error "BCE0005: Unknown identifier: 'HandleConnection'." for this line:

SFSEvent.onConnection += HandleConnection;

SFSEvent.onConnection is a delegate, a feature which is not currently supported in Unity's Javascript. To attain an equivalent effect in Javascript, you'd need to convert SFSEvent.cs in the SmartFox source (SFS_CSharp/API/sources/SmartFoxClient) to JS. All of the delegates in there would need to be converted to a list or some other structure to which you would add functions that match the signature of the delegate. Anywhere those delegates are called, you would need to iterate through the list, calling those functions.