Skip to content

Instantly share code, notes, and snippets.

@rbraeunlich
rbraeunlich / Server.java
Created September 18, 2016 13:51
The server implementation for Akka and WebSockets
package de.blogspot.wrongtracks.websocket.server;
import static akka.http.javadsl.server.Directives.handleWebSocketMessages;
import static akka.http.javadsl.server.Directives.path;
import java.util.concurrent.CompletionStage;
import akka.NotUsed;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
@rbraeunlich
rbraeunlich / script.js
Created September 18, 2016 13:52
The JavaScript code for the client
var connection = new WebSocket('ws://localhost:8080/greeter');
connection.onopen = function(){
connection.send('connect');
}
connection.onerror = function (error) {
console.log('WebSocket Error ' + error);
};
connection.onmessage = function(e){
package foo.bar
import akka.actor.ActorSystem
import akka.testkit.TestKit
import org.scalatest.WordSpecLike
class ActorSystemSpec extends TestKit(ActorSystem("test"))
with WordSpecLike{
"Test" must {