Disable multiple websocket connection from the same webbrowser tab - java

is there any way to block / close multiple websocket connection from the same browser tab for a client?
I'm creating simple card game using javax.websocket in a backend and pure js in frontend. In the app I'm not going to use any login and password authentication system.
I'm looking for some method where I can close second connection if the client is already connected.
Thanks!

This would work if there was some kind of unique identifier for each player (ie. authorization token).
Otherwise you could check their IPs, whether they are already connected and disconnect them if so. This can be easily bypassed, and there arise issues when there's multiple clients from one router.

Related

how to disable automatic connection to a saved wi-fi network

I want to disable automatic connection and authentication to saved network and delegate these functions to program, but I didn't find API for this.
Automatic disconnection after connection or trying is not a solution, because client already generate and receive authentication frames, which can be used by badboy for WPA(2)-PSK password recognition.
Also I don't want to save connection parameters for networks in program and erase saved networks in standard wi-fi service.
Please tell me about API or code example for this task.

Streaming a python game through a jsp

So im creating this game using pygame, and i have to put it up on a website, but it has to run server-side since the game is gonna be using a database locally, and the client will be able to enter a web page and click on a button and the game is gonna run, i cant make the game run completely client side because then the game wont be able to connect to my local database
Any ideas?
The way I see it you have two options:
If network connection is intermittent (not so frequent), you can use javascript (AJAX specifically) to make HTTP calls to the server whenever you need to access your database.
If you are expecting frequent (continuous) requests (i.e. multiplayer games), you would need to keep a connection alive using either
Persistent HTTP request
TCP Socket
Websocket : You probably want to use this if you want cross-browser support.
Let me know if you have any other questions regarding the options above.

Server to Server Communication with Java

I am currently developing a game, and would like to separate the login server from the game server. While I am experienced with client-server networking, I have never done any work communicating between servers. What are some standard or accepted methods of accomplishing this? My current topology(?) is to have the game client connect to the game server, handle all logging in and authentication, and then start processing game data/packets. What I would like to do, is split the login server and game server into separate entities, such that the client will initially connect to the login server, after proper authentication has been reached, send the client over to the game server and start processing game data.
What would be an acceptable way of handling this?
EDIT: It seems the intention of the question may be unclear. My question is, is there some sort of functionality that would allow server-server communication, OTHER than creating the login server as a client to the game server?
No, There is not. One of the two parties always needs to be listening for connections while the other end connects to it.

app engine: communicate with Java app behind firewall

I want to have a Java-Application that is behind a firewall (maybe even connected over a 3G modem) and I have a google app-engine application.
How can the gae app push data to the clients?
I found some ways that look promising, but I'm not sure what will really work.
Sockets will not work, because I cannot connect through the firewall/3G barrier
the channel API only works with JS clients
XMPP looks very promising - the client would report it's presence and the server could push chat-messages to the client and also the client could reply that way.
But what about user-accounts? i.e. could I use a single XMPP-account for all users (and let the client send a unique ID to identify the user) - or is a unique XMPP account for every device (which runs the java-aplication behind the firewall) required?
are there any other options or are there some XMPP gotcha's you know about?

Java Socket know when request to gmail

I'm trying to create an application event (java) that would raise as soon as the machine gets connected to gmail onto the login page (https://www.google.com/accounts/), so I'm trying to build a Socket that would listen to this particular httprequest.
but I can only create a ServerSocket that listens to a port, to a specific ip adress (gmail login page can have so many different ips), but not to a host...
anyone got an idea ?
thank you !
This should help you get started:
http://gforgeek.blogspot.com/2005/04/simple-packet-sniffer-using-java.html
EDIT:
I just checked and I think you're going to have a really hard time accomplishing this because gmail runs on HTTPS so even once you get the packet sniffer running you're going to have to decrypt all SSL communications. I'm not even sure that's possible.
Best bet is inside the browser like Google's Mail Checker extension for Chrome. Modify the extension to forward notifications to a localhost HTTP service which your Java application is hosting.

Categories