I am trying to add a Play Framework web server as part of a larger application, but the main purpose of the application is NOT a web server. It already accepts many connections, including serial and TCP, but I need to add WebSockets, and preferably the Play Framework WebSocket interface. (We tried Undertow and faced a lot of problems with its awkward interface)
I just got to creating the application and started it, but I canβt connect to it. After running the following code, port 8000 does not listen. 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
source share