All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xitrum.FlashSocketPolicyServer.scala Maven / Gradle / Ivy

The newest version!
package xitrum

import io.netty.channel.socket.SocketChannel
import io.netty.channel.{ChannelInitializer, EventLoopGroup}
import xitrum.handler.inbound.FlashSocketPolicyHandler
import xitrum.handler.{Bootstrap, NetOption}

object FlashSocketPolicyServer {
  def start(): Seq[EventLoopGroup] = {
    val (bootstrap, groups) = Bootstrap.newBootstrap(newChannelInitializer())

    val port = Config.xitrum.port.flashSocketPolicy.get
    NetOption.bind("Flash socket", bootstrap, port, groups)

    Log.info(s"Flash socket policy server started on port $port")
    groups
  }

  private def newChannelInitializer(): ChannelInitializer[SocketChannel] = {
    (ch: SocketChannel) => {
      ch.pipeline.addLast(new FlashSocketPolicyHandler)
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy