Hey thanks for the reply,
1. I am using the sources available through the Download link on
smartsocket.net, as it shows in the video.
2. Re: BINARY RemoteCalls... I only see one import option when I add this line:
RemoteCall call = new RemoteCall("onGreeting", json.get("directTo").getAsString());
... that import option is:
import net.smartsocket.protocols.json.RemoteCall;
.... Server-Side code:
package smartsockettut1;
import com.google.gson.JsonObject;
import net.smartsocket.Config;
import net.smartsocket.Logger;
import net.smartsocket.protocols.json.RemoteCall;
import net.smartsocket.serverclients.TCPClient;
import net.smartsocket.serverextensions.TCPExtension;
public class SmartSocketTut1 extends TCPExtension {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Config.useGUI = false;
new SmartSocketTut1().start();
}
public SmartSocketTut1 () {
super(8888);
}
public void greeting(TCPClient client, JsonObject json) {
Logger.log( "Client said: "+json.get( "message" ).getAsString() );
RemoteCall call = new RemoteCall("onGreeting", json.get("directTo").getAsString());
call.put("serverResponse","Hi, I recieved your greeting!");
client.send(call);
}
@Override
public void onExtensionReady() {
Logger.setLogLevel(0);
Logger.log("I'm ready");
}
@Override
public void onConnect(TCPClient client) {
}
@Override
public void onDisconnect(TCPClient client) {
}
@Override
public boolean onDataSpecial(TCPClient client, String methodName, JsonObject params) {
return false;
}
}
..... Client-Side code:
package {
import flash.display.Sprite;
import flash.events.*;
import net.smartsocket.SmartSocketClient;
import net.smartsocket.protocols.json.RemoteCall;
public class sstut1 extends Sprite {
public var s:SmartSocketClient = new SmartSocketClient();
public function sstut1() {
SmartSocketClient.addDataListener("main", this);
s.addEventListener(Event.CONNECT, onConnect);
s.connect("localhost", 8888);
}
public function onConnect(event:Event):void {
var call:RemoteCall = new RemoteCall( "greeting", "main" );
call.message = "Client greeting!";
SmartSocketClient.send(call);
}
public function onGreeting(call:RemoteCall):void {
trace(call.serverResponse);
}
}
}