Skip to content

Instantly share code, notes, and snippets.

@dcaoyuan
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcaoyuan/11204015 to your computer and use it in GitHub Desktop.
Save dcaoyuan/11204015 to your computer and use it in GitHub Desktop.
val observer = new Observer[OnEvent] {
override def onNext(value: OnEvent) {
case OnEvent("Hi!", args, context) =>
if (value.packet.hasAckData) {
value.ack("[]")
}
value.reply("welcome", List(Msg("Greeting")).toJson.toString)
}
}
val channel = Subject[OnData]()
channel.ofType[OnEvent].filter(_.name == "Hi!").subscribe(observer)
namespaceExt.namespace("test") ! Namespace.Subscribe(channel)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment