Multiple websocket server? [closed] - javascript

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I make a webapp in javascript and java. Run localhost:8080 in NetBeans with GlassFish Server 5. I need make in a HTML page a chatroom and a poker tables with 6 clients. Chatroom is fine, used java websocket ServerEndpoint and JS client. But I want another channel for the game of poker. I tried to make another websocket ServerEndpoint but it doesn't work if i create it on port 8080. How can i solve it? It is important that I can only use java and javascript.

Maybe you can create a request type in your server code ,and when client connect to that server for different purposes sends relevant type of requests. E.g. chatroom client sends request with a parameter like {requestType:"chat"} and other one sends {requestType:"game"} among other parameters neccessary for your application.

Related

What can I use to ping a site on a specific port and see if it's online or not? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
So, my friend has a Minecraft server running out there. I want our Discord Bot to ping the server's IP, e.g myfriendsserver.mc . Now, I want it to check if the server is online or not. If it's online, I want to have the bot ping that it's online, else it's going to say the server is offline.
I believe the code is going to be fairly simple, but I'm unsure about how exactly I should approach this problem.
// Create WebSocket connection.
const socket = new WebSocket('ws://localhost:8080');
The minecraft server will likely utilize the WSS server already, you would just need the client to connect to it, get past hand-shake and then send pong anytime the server sends ping.
This will keep a heart-beat going and from there at any-point it takes to long to get a response we call it offline till next-connection.
There's certainly many methods for checking connection of the server, another method could be utilizing an HTTP server and say at location http://127.0.0.1/get-status it'd output you the following in JSON.
{"status":"online"}
or even
{"status":"busy too many requests"}
I'd probably for simplicity utilize the WebSockets as they should already be in use adaptation would be minimal.

Website building, ask server to run a script with input [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm quite a newbie in everything related to web development, but I had this project in my mind that I really wanted to realize.
At the moment I am struggling with a method to send a request to the server hosting the website. The idea is that from the site you can enter keywords, and those keywords should be run in a script (python or java(script)) on the server after which it returns an output to the webpage. In theory this script could be executed in the website itself as javascript, but I would like to use the computing power and internet access from the server.
I have researched on using Json and javascript for the job, but I think there has to be a better way for this purpose. Is there anyone that can direct me where to look?
You should build your form in HTML. (More info: https://www.w3schools.com/html/html_forms.asp)
In client-side JavaScript (the code that website users have executing in their browser), you should use the jQuery library to scoop the data out of your form. Take a look at the .submit() and .val() functions to get started. Then you can use jQuery's AJAX function to submit requests to the server-side API in a JSON format.
On the server, in addition to creating a way of serving up the webpages (with their client-side JavaScript), you will then need to create an API to receive and respond to these requests. One way to do this is by running Node.js with Express, which will allow you to write your API in JavaScript. The downside to this is you will have to pay to get a full-fledged virtualized cloud server through AWS, Rackspace, or another host. The other option is for you to write your API in PHP, which is supported by free webhosts like x10hosting.com.

can't configure socket.io with Google Firebase [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I am trying to make a simple chat app in which people will just send the message to everyone.
but I am not able to make it
These pictures will say you everything that I am doing.
Please correct me where I am wrong.
From node.js back-end code, start listening to the requests by -
server.listen(...);
And make sure that the server and the client ports are same(or port forwarding is there if different.).
And if using TCP protocol then that port should be open.

How to connect html page to Marklogic Database using javascript? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am newbie to web designing. Here I am trying to develop a web page where it prompts for username and password and when I click on button, this html has to make connection with these username and password values entered by user to Marklogic database . Could anyone please help how to do this? Is it through Javascript or PHP? If so please advise where can I find step by step explanation of this process ? Also it is okay if I get procedure for any NOSQL database.
OK. Your statement is a bit big and broad.. I decided to extract the most relevant concepts:
Sample Application including authentication
MarkLogic
Javascript or PHP
Therefore, I suggest looking at a reference framework using all javascript:
http://www.marklogic.com/what-is-marklogic/whats-new/samplestack/
This can have a node.js middle tier in node.js and does not require java.
It is a big step forward and (sort of) complex, but it is a complete example.
If it is too much for what you are looking for, then I suggest you research more specifically what you need in these two specific items in MarkLogic documents:
HTTP Server (where you can run your HTML/CSS/Javascript from)
REST API (for which you can use against your js code)
This is a 2-tier approach where your application(HTTP) server is serving both your HTTP site as well s the default REST enpoints.

Build website using JSP or Javascript [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have to build a website which involve e-commerce stuff like it should allow the users to login and then view the available items. Once the user selects the items and makes payment, it may need additional information in the form of some images/videos to complete the order. So, after payment step, it prompts the user to upload the file and when the file is uploaded on the server, request is complete and the user is kept informed about the status.
All the core functionality is already implemented using REST-ful webservices. I am not able to decide if I should implement the website using HTML+JS (using AJAX to call webservices) or should still use JSP and call webservices using java at server side? Someone suggested me that using JSP is better since it will execute on server side and hence will be secured and faster. But, I somehow feel that HTML+JS is easier to go. Is there some specific advantage to use a server side script like JSP for this purpose? Any ideas are most welcome.
Yes server side scripting will be fruitful for this purpose for security constraints. Or you can use angular js though they are easy to learn and they are secure and can make fast XHR request response. :)

Categories

Resources