How to create my own STUN or TURN server using java
Asked Answered
P

2

7

I have been working on a video chat application using WebRTC and using Java Websocket as a Signalling server.

This application is working successfully on Tomcat.

Currently I am using​ Google's STUN server.

var pc_config = {"iceServers": [{"url": "stun:stun.l.google.com:19302"}]}; var pc = new RTCPeerConnection(pc_config);

I don't want to relay on a public or 3rd party STUN server, like above.

Since my application will be published to public Tomcat server with dedicated domain. I want use/setup my own STUN or TURN server.

Can I do that with Tomcat?
Are there any stable open-source libraries available for this?

Please point me to an example if any such.

Persephone answered 19/5, 2017 at 14:24 Comment(0)
C
6

I think trying to cram signaling and NAT traversal (=STUN/TURN server) is the wrong approach. The way you handle scaling with them are different, and the surface of each that you end up exposing towards the open internet is also different.

Due to these reasons, there's no real problem of using a different language/tech for the STUN/TURN server. I'd go with either coturn or restund here.

There are also a few managed commercial services you can use instead of deploying your own, and they really aren't expensive.

Creaturely answered 21/5, 2017 at 5:0 Comment(0)
L
2

The better way is to use an open source solution as a service on your server. Example: https://github.com/coturn/rfc5766-turn-server/ - it is functional and stable, supports additional features.

AFAIK, there are no Java STUN/TURN libs that can work under Tomcat. Although, there are some open source Java-based projects, like this one: https://github.com/jitsi/turnserver

Lascar answered 19/5, 2017 at 14:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.