Skip to content

Commit

Permalink
Fixed CommunicationServer.register.
Browse files Browse the repository at this point in the history
  • Loading branch information
darkfrog26 committed Oct 11, 2016
1 parent 4321a57 commit 167e0df
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import io.undertow.websockets.WebSocketConnectionCallback
import io.undertow.websockets.core.{AbstractReceiveListener, BufferedTextMessage, StreamSourceFrameChannel, WebSocketChannel, WebSockets}
import io.undertow.websockets.spi.WebSocketHttpExchange
import org.hyperscala.communication.Communication
import org.hyperscala.Server
import org.hyperscala.{Handler, Server}
import pl.metastack.metarx.Channel

class CommunicationServer(path: String,
Expand Down Expand Up @@ -53,6 +53,10 @@ class CommunicationServer(path: String,
}
}

def register(server: Server): Unit = {
Handler.pathMatch(path).withHandler(Handlers.websocket(this)).register(server)
}

override def onConnect(exchange: WebSocketHttpExchange, channel: WebSocketChannel): Unit = synchronized {
val authorized = authorization(exchange) match {
case Some(auth) => exchange.getRequestHeader(Headers.AUTHORIZATION_STRING) == auth
Expand Down

0 comments on commit 167e0df

Please sign in to comment.