I'm trying to add a Play Framework web server as part of a larger application, but the application's primary purpose is NOT a web server. It already accepts a variety of connections, including serial and TCP, but I need to add WebSockets, and Play Framework's WebSocket interface is preferable. (We've tried Undertow, and encountered too many problems with its clunky interface)
I've only gotten as far as creating an application, and starting it, but I'm unable to connect to it. After I run the following code, nothing is listening on port 8000. What do I need to do?
application.conf:
play.server.http.port=8000
http.port=8000
webserver.scala:
def startWebServer = {
val environment = new Environment(
new File("/path/to/app"),
classOf[Dummy].getClassLoader,
play.api.Mode.Dev
)
val context = play.api.ApplicationLoader.createContext(environment)
val application = ApplicationLoader(context).load(context)
play.api.Play.start(application)
}
build.sbt:
libraryDependencies += "com.typesafe.play" %% "play" % "2.5.0-M1"
Output:
[info] play.api.Play - Application started (Dev)
You can download the code here: github.com/alancnet/playtest