engine.io - Engine.IO is the implementation of transport-based cross-browser/cross-device bi-directional communication layer for Socket.IO.
$ sbt clean publish-local
Before running the tests the first time, you must ensure the npm packages are installed:
$ npm install
Then you can run the tests:
$ sbt test
import io.scalajs.npm.engineio._
import io.scalajs.nodejs.buffer.Buffer
import scala.scalajs.js
val server = EngineIO.listen(80)
server.on("connection", { socket: Socket =>
socket.send("utf 8 string")
socket.send(Buffer.from(js.Array(0, 1, 2, 3, 4, 5))); // binary data
})
import io.scalajs.npm.engineio._
import io.scalajs.nodejs.buffer.Buffer
import io.scalajs.nodejs.http.Http
val http = Http.createServer()
http.listen(3000)
val server = EngineIO.attach(http)
server.on("connection", { socket: Socket =>
socket.on("message", (data: Buffer) => {})
socket.on("close", () => {})
})
To add the engine.io
binding to your project, add the following to your build.sbt:
libraryDependencies += "io.scalajs.npm" %%% "engine-io" % "0.4.1"
Optionally, you may add the Sonatype Repository resolver:
resolvers += Resolver.sonatypeRepo("releases")