Invoke the Play based application using UDP/HTTP

I have a requirement where the client sends out data via UDP/TCP, is there a way to accept these requests in play?
I understand that play is used for HTTP methods (like GET/POST) where you configure the routes and then invoke accordingly.

Yes, Play is a HTTP framework.

Of course, if you you want/need, you can embed a custom UDP/TCP server running aside of Play HTTP server, but this is not something supported out of the box.

Best.

Thanks for the reply… But how do I invoke the play application via UDP? any UDP request that I make is searching in routes file thereby throwing an exception.

I think if you embed a UDP server as suggested by @marcospereira, then you will be communicating with your application via the custom UDP port, instead of the standard HTTP port from Play. So instead of hitting/sending to localhost:9000 (default Play HTTP), you would hit localhost:embedded_UDP_server_port instead.

But if this is the case, I wonder why not just run the UDP server as a standalone.

Firstly thanks for a detailed response. Initially I took the route of Play f/w, but I did-not see any advantage of accommodating UDP inside play, so I started again with a standalone UDP server which accepts requests asynchronously. Now I’m trying to fit in HTTP akka which helps in managing concurrency.

Perhaps you can just use Akka itself to help with managing concurrency if you do not plan to use HTTP at all.

I meant AKKA, not HTTP Akka :slight_smile:
Here’s my final approach Standalone UDP Server with AKKA and Netty…