Fun with Flotype

24 Apr 2012

I came across this new start up Flotype through a blog at hacker news.
It provides cross-language services to expose data and realtime updates to client devices and browsers.
They have simple APIs which can be used right away.  So I created a new account and started playing with the beta version. My first idea is to setup the server on my laptop and client on my android phone. So whenever server receives the message, it makes a system call for the message. That way I could use my laptops terminal remotely. Since it's available only in Javascript,Java,Ruby and Python, I chose Java.
First of all I created a server on my laptop:
 import com.flotype.bridge.*;  
class ChatObj implements BridgeObject {
public void message(String sender, String message) {
System.out.println(sender + ":" + message);
Process execAcrobatPrs=null;
execAcrobatPrs = Runtime.getRuntime().exec(new String[]{"sh", "-c",message});
catch(Exception ex)
public class AuthServer {
public static void main(String[] args) throws Exception {
Bridge bridge = new Bridge()
bridge.joinChannel("channel-name", new ChatObj());
and the client for android:
 package com.jiten;  
import com.flotype.bridge.*;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
interface RemoteChat extends BridgeRemoteObject {
public void message(String sender, String message);
public class MessageSenderActivity extends Activity implements OnClickListener{
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
Button b = (Button) findViewById(;
b.setOnClickListener((android.view.View.OnClickListener) this);
public void onClick(View arg0) {
if(arg0.getId() == {
EditText t = (EditText) findViewById(;
Bridge bridge = new Bridge().setApiKey("myprivatekey");
RemoteChat channel = bridge.getChannel("channel-name", RemoteChat.class);
channel.message("Jiten", t.getText().toString());
try {
} catch (IOException e) {
// TODO Auto-generated catch block

That's it. Now I can run any terminal command from my laptop through my android phone.
This still is not interactive so it's of no use for commands like 'ls' but you can run applications in which you don't need interaction.
Well, I can't think of any important use for this but it was fun starting 'Catalyst' in my laptop through a command in my mobile phone. In future I might improve it for interactivity. 

Discussion, links, and tweets

Software Engineer at AWS using simulation to train robots. I am obsessed about history.