Live API

To use the live api you need an WebSocket implementation.

You then need to make a connection to wss://open.ge.tt.

All messages over the socket are JSON on the form:

{
    "type":"the message type"
}

except for ping messages.

NB: There is one non-JSON ping message that you need to implement

Once every 2 minutes you will receive a ping message ping over the websocket. You need to answer back with the message pong otherwise the server will close the connection.

send type = connect

When you are ready to receive live notifications you should send then following message:

{
    "type":"connect",
    "accesstoken":"a.rsdf33223drfds...",
    "session":"42a3414" // the session string you use to create files
}

Afterwards you'll receive the following notifications. All files with the same session as the one you have given in this message will now also show up in share listings event though their readystate is set to remote as you'll now receive a download notification when someone tries to fetch them so you can start uploading them.

receive: type = download

When someone is attempting to download a file you'll receive a download message of the following form

{
    "type":"download",
    "sharename":"9adfr",
    "filename":"test.txt",
    "fileid":"0"
}

If you are not currently uploading this file you should start to do that now.

receive type = storagelimit

If you are uploading a file and you are going above your storage limit you'll receive this message

{
    "type":"storagelimit",
    "sharename":"9adfr",
    "filename":"test.txt",
    "fileid":"0"    
}

receive type = filestat

When a file is starting to upload you'll receive a filestat event containing the size of the file. This is mostly useful in a browser environment where you don't have access to file sizes.

{
    "type":"filestat",
    "sharename":"9adfr",
    "filename":"test.txt",
    "fileid":"0",
    "size":5366
}

receive type = violatedterms

If a file is being uploaded that violates the terms of use you'll receive this event

{
    "type":"violatedterms",
    "sharename":"9adfr",
    "filename":"test.txt",
    "fileid":"0",
    "reason":"virus" // the reason why it is violating the terms        
}