Last active
January 15, 2019 08:36
-
-
Save AxGord/ff85d5ad4465f5634155de1f6bc78632 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pony.net.*; | |
import pony.net.rpc.*; | |
import pony.events.*; | |
import pony.time.MainLoop; | |
class RPCExample { | |
private static function main():Void { | |
MainLoop.init(); | |
var server = new ExampleProtocol(new SocketServer(12345)); | |
var client = new ExampleProtocol(new SocketClient(12345)); | |
server.onMessage.add((message:String) -> trace('Received: $message')); | |
server.onMessage.add(MainLoop.stop); | |
client.messageRemote('hello'); | |
MainLoop.start(); | |
} | |
} | |
class ExampleProtocol extends RPC<ExampleProtocol> implements IRPC { | |
@:rpc public var onMessage:Signal1<String>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment