Permalink
Browse files

woot, docker!

  • Loading branch information...
ilanpillemer committed Aug 5, 2017
1 parent 62df900 commit 33cfa37416ea399331fd43814bd0b2da7fd2cf7a
Showing with 26 additions and 6 deletions.
  1. +4 −0 app/views/index.scala.html
  2. +14 −1 build.sbt
  3. +3 −1 conf/application.conf
  4. +5 −4 public/javascripts/main.js
@@ -8,6 +8,10 @@ <h1>Sample scala room is running!</h1>
<div class="page-header">
<h4>Preformed Messages, try them, edit them, or just write your own</h2>
</div>
<div class="form-group">
<label for="wsdest">websocket uri:</label>
<input type="text" class="form-control" id="wsdest">
</div>
<p>
<div class="row">
<div class="col-sm-2 well"><button type="button" onclick="roomHello()" class="btn btn-primary btn-block">Hello</button></div>
View
@@ -1,4 +1,4 @@
name := """sample scala room"""
name := """sample room scala"""
organization := "com.ilanpillemer"
scalacOptions ++= Seq("-deprecation", "-feature")
@@ -7,6 +7,8 @@ version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
enablePlugins(DockerPlugin)
scalaVersion := "2.12.2"
libraryDependencies += guice
@@ -19,6 +21,17 @@ libraryDependencies += "com.typesafe.akka" %% "akka-stream-testkit" % "2.5.3" %
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "3.0.0" % Test
libraryDependencies += "org.awaitility" % "awaitility" % "3.0.0" % Test
// Adds additional packages into Twirl
packageName in Docker := packageName.value
version in Docker := version.value
dockerBaseImage := "openjdk"
dockerExposedPorts := Seq(9000, 9443)
dockerExposedVolumes := Seq("/opt/docker/logs")
//TwirlKeys.templateImports += "com.ilanpillemer.controllers._"
// Adds additional packages into conf/routes
View
@@ -1,2 +1,4 @@
# https://www.playframework.com/documentation/latest/Configuration
play.filters.headers.contentSecurityPolicy = "default-src 'self' 'unsafe-inline' ws://localhost:9000/room"
play.filters.hosts.allowed=["."]
play.http.secret.key=JPsP9ZCTMHZvAeKERln1tW5sSsThfol2
play.filters.headers.contentSecurityPolicy = "default-src 'self' 'unsafe-inline' ws://*:9000/room"
@@ -1,9 +1,11 @@
var wsUri = "ws://localhost:9000/room";
var wsUri = "ws://" + window.document.location.host + "/room";
var output;
function init() {
output = document.getElementById("output");
input = document.getElementById("input");
wsdest = document.getElementById("wsdest");
wsdest.value=wsUri;
testWebSocket();
}
@@ -67,7 +69,7 @@ function gowest() {
function testWebSocket() {
websocket = new WebSocket(wsUri);
websocket = new WebSocket(wsdest.value);
websocket.onopen = function(evt) { onOpen(evt) };
websocket.onclose = function(evt) { onClose(evt) };
websocket.onmessage = function(evt) { onMessage(evt) };
@@ -94,7 +96,7 @@ function writeToScreen(message) {
}
function onOpen(evt) {
writeToScreen("CONNECTED");
writeToScreen(wsdest.value + "...CONNECTED");
}
function onClose(evt) {
@@ -103,7 +105,6 @@ function onClose(evt) {
function onMessage(evt) {
writeToScreen('<span style="color: blue;">RESPONSE: ' + evt.data+'</span>');
//websocket.close();
}
function onError(evt) {

0 comments on commit 33cfa37

Please sign in to comment.