-2

I have created a chat application in Java using Java Sockets. Now I want to connect the Java Server of chat application with the front end in ReactJS. I want to know how can I achieve it.

Till now i have created a Chat application in Java, where i created a Server and Client are connected using Java Sockets. I also have a frontend in ReactJS. I am confused how Can I connect my frontend ReactJS with the Java Server, since i have used Java Sockets in the server and there is no Java Sockets in Reactjs.

2
  • You can use Apache Tomcat for that. Commented Nov 1, 2022 at 5:07
  • Welcome. You should take a look at How to Ask and take the tour, if you have not done so already. This is general information that you should keep in mind, when asking questions. Commented Nov 1, 2022 at 6:36

1 Answer 1

1

You can't . JavaScript can not connect to Java Sockets.

Your best option is to implement your Java server to support WebSocket. then you can connect to it from javascript in browser using ws:// protocol.

this might help you: How to implement a WebSocket Server in java?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.