Re: Simple Echo WebSocket sample

270 views
Skip to first unread message

Alex Jarvis

unread,
Jun 23, 2012, 7:48:41 PM6/23/12
to play-fr...@googlegroups.com
This is really interesting - have you run any benchmarks yet?

I would quite like to see how Play stacks up against Webbit as shown in the results here - https://github.com/ericmoritz/wsdemo/blob/results-v1/results.md

On Saturday, 23 June 2012 15:56:02 UTC+1, Maga Abdurakhmanov wrote:
Hi!
I'm trying to implement very simple echo server using WebSockets, to test how playframework will handle 10K websocket connections. There is some tests with different servers (including java+netty) here https://github.com/ericmoritz/wsdemo/

So I have the following piece of code, but suspect that it will not handle that many connections.
Could you please advice how to do it in more reactive way, better not using actors:

def index = WebSocket.using[String] { request =>
      val out = Enumerator.imperative[String] {
    }
    val in = Iteratee.foreach[String] { s =>
      out.push(s)
    }
    (in, out)
  }

Guillaume Bort

unread,
Jun 24, 2012, 5:57:09 AM6/24/12
to play-fr...@googlegroups.com
Have you tried this? It looks ok to me. 


On 23 juin 2012, at 16:56, Maga Abdurakhmanov <maq...@gmail.com> wrote:

Hi!
I'm trying to implement very simple echo server using WebSockets, to test how playframework will handle 10K websocket connections. There is some tests with different servers (including java+netty) here https://github.com/ericmoritz/wsdemo/

So I have the following piece of code, but suspect that it will not handle that many connections.
Could you please advice how to do it in more reactive way, better not using actors:

def index = WebSocket.using[String] { request =>
      val out = Enumerator.imperative[String] {
    }
    val in = Iteratee.foreach[String] { s =>
      out.push(s)
    }
    (in, out)
  }

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/BMrev4DFCCMJ.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Maga Abdurakhmanov

unread,
Jun 24, 2012, 12:59:10 PM6/24/12
to play-fr...@googlegroups.com
Ok, finally I've succeeded in implementing this test and pushed to the author to get the results on the same environment.
Current code looks like this:

def index = WebSocket.using[Either[String, Array[Byte]]] { request =>
      val out = Enumerator.imperative[Either[String, Array[Byte]]] {
    }
    val in = Iteratee.foreach[Either[String, Array[Byte]]] { s =>
      out.push(s)
    }
    (in, out)
  }

Sadache Aldrobi

unread,
Jun 25, 2012, 10:42:31 AM6/25/12
to play-fr...@googlegroups.com
What to use Either[String,Array[Byte]] as the type of your message?

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/P3R_g7suzBQJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.



--
www.sadekdrobi.com
ʎdoɹʇuǝ
Reply all
Reply to author
Forward
0 new messages