Raised This Month: $51 Target: $400
 12% 

Gameserver Chat to Browser


Post New Thread Reply   
 
Thread Tools Display Modes
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 07-20-2016 , 07:39   Re: Gameserver Chat to Browser
Reply With Quote #21

Wait... I thought my solution was simple haha. I think I missunderstood something. Mine solution just require a sourcemod plugin with the extension Socket and a website wich query the server, that's it.
__________________
Want to check my plugins ?

Last edited by Arkarr; 07-20-2016 at 07:39.
Arkarr is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 07-20-2016 , 07:41   Re: Gameserver Chat to Browser
Reply With Quote #22

Quote:
Originally Posted by Arkarr View Post
Wait... I thought my solution was simple haha. I think I missunderstood something. Mine solution just require a sourcemod plugin with the extension Socket and a website wich query the server, that's it.
And let me guess, you're opening TCP 12345 with the Socket extension at the SourceMod plugin, so the other end ("website") connects to GAME_SERVER_IP at port 12345 whenever it requests the data? (Port 12345 is just an example)
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].

Last edited by DarkDeviL; 07-20-2016 at 07:41.
DarkDeviL is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 07-20-2016 , 08:03   Re: Gameserver Chat to Browser
Reply With Quote #23

Quote:
Originally Posted by arne1288 View Post
And let me guess, you're opening TCP 12345 with the Socket extension at the SourceMod plugin, so the other end ("website") connects to GAME_SERVER_IP at port 12345 whenever it requests the data? (Port 12345 is just an example)
Yeah. That should do the trick. Correct me if I'm wrong, but that's how Socket work.
__________________
Want to check my plugins ?

Last edited by Arkarr; 07-20-2016 at 08:04.
Arkarr is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 07-20-2016 , 09:14   Re: Gameserver Chat to Browser
Reply With Quote #24

Quote:
Originally Posted by Arkarr View Post
Yeah ? That should do the trick.
And then someone F5 spamming on your site leads to spamming the game server, leads to server lagging and/or crashes in the end. Just like if someone is flooding your RCON port.

Serious deals are done game servers one place, mysql/website at another place, and done the database way, visitors will only have the ability to flood and possibly affect the performance of your SQL and website servers, not the game server as they will have with your Socket solution.

For people just renting game servers (not virtual servers/machines or dedicated servers), they don't have access to put up firewalls and other things to protect their servers from such stuff.

I see (possible) vulnerabilities the way you want to do it, that won't be there (in the same kind of way, at least) with the database solution.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 07-20-2016 , 09:36   Re: Gameserver Chat to Browser
Reply With Quote #25

Quote:
Originally Posted by arne1288 View Post
[...]For people just renting game servers (not virtual servers/machines or dedicated servers), they don't have access to put up firewalls and other things to protect their servers from such stuff.[..]
That's the only real problem. Concerning the spam problem, you simply check wich IP try to connect too much in a specific time span, then you ban or kick it for X seconds.
__________________
Want to check my plugins ?
Arkarr is offline
Deathknife
Senior Member
Join Date: Aug 2014
Old 07-20-2016 , 10:25   Re: Gameserver Chat to Browser
Reply With Quote #26

Quote:
Originally Posted by Arkarr View Post
Storing message that should be seen only once (it's a chat after all) and query the database every X miliseconds to get those message is bad, I guess.

Socket allow us to send temporary array of bytes, wich is exactly what a chat is doing. For exemple :

PlayerX send "test"
SERVER receive "test"
SERVER send to all other Player "test"

There is no database involved.

Plus, the database will be quickly slower and slower (speaking of miliseconds, wich also mean, more resources and time consumed.) since there will be ALOT of messages / day. Then you might say :
"Well, we could always limit the database to a certain ammount of data, for exemple 10 last messages."
That sound ridiculus, doesn't it ? Database is definitly not the best solution to handle the problem.

Also, using a database just for that require more things to install take more ressources and definitly slower then socket.

But that's my point of view, I don't mean to start any war or anything like that. I might be wrong, and if I am, please point it so I can learn.

Anyway I can't find a way of doing it using sockets and without NodeJS, so I might be definitly wrong.
WebSocket might be worth looking into if you want to do it that way. https://forums.alliedmods.net/showthread.php?t=182615

I still think using database would be the way to go. Refreshing once a second is enough, a simple query to select from chat where timestamp is greater than the last. You can purge the chat logs older than 7 days or whatever you wish if you want to keep the table size small.

MySQL is not slow, it can easily handle thousands of queries a second. Speed isn't really a concern here.

With the system you are thinking of, you would only be able to see the messages from the time you connect(i.e open the page), unless you store the messages somehow. Which will look ugly when there isn't enough messages from the time you opened it.

Quote:
Also, using a database just for that require more things to install take more ressources and definitly slower then socket.
If you have a website, you probably already have MySQL and PHP installed, which is probably as much as you need.

When I was playing around with sockets, it only did roughly 4/5 requests a second. (If it can handle more, please correct me) Establishing connection from client directly to server would be definite no in that case, so you would need some sort of server that the gameserver connects to, and any clients. Which would require more things to install.
__________________
Deathknife is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 07-20-2016 , 10:35   Re: Gameserver Chat to Browser
Reply With Quote #27

Quote:
Originally Posted by Arkarr View Post
That's the only real problem. Concerning the spam problem, you simply check wich IP try to connect too much in a specific time span, then you ban or kick it for X seconds.
Yes, and you will waste your game server's precious CPU and memory resources, on processing things that are technically irrelevant for the game server to process, meaning that there will be fewer resources available to provide quality servers to your gamers.

Resource hogging things like that aren't on the game server when going the database way, as the end users then won't interfere directly with the game server at all; and you won't waste the resources there.

If they are spamming on the database way, they can only affect your web server and eventually the SQL server, depending on how hefty they are spamming it. The game server won't be affected like it would be otherwise.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 07-20-2016 , 11:23   Re: Gameserver Chat to Browser
Reply With Quote #28

Alright, you bought me. I give up.
__________________
Want to check my plugins ?

Last edited by Arkarr; 07-20-2016 at 11:24.
Arkarr is offline
Yeradon
Junior Member
Join Date: Feb 2016
Old 07-21-2016 , 04:56   Re: Gameserver Chat to Browser
Reply With Quote #29

I like your discussion guys, but i guess you got way to much into detail.

Limiting a port to a certain ip isn't to hard. It also wont cost you a lot of ressources. Sending a database query for each chat entry will. If i would like to dos attack your server, i would just spam the chat (You have Anti-Spam for the chat).

Never mind, there is another reason for using an api instead. Normally you want one centralized input flow into your database. This way you can change authorization, authentification and input rules easier and faster. If you use http, sockets or something different to communicate with that api, is another question. Sockets might be the best way for a realtime application, but i don't know about the sourcemod implementation.

You also can put them directly into the database. It probably will work without any noticeable lags. But it's definitely not the best way to do it. Although it's the easiest.

There two things left to say about the saigns website. First, you don't know how they are getting their logs into that database. Second, there is the problem with the private data. I know that America isn't really worrying about it, but saving the chat log and publishing it (without the usere's permission) is illegal here in Europe.

JM2C.

Last edited by Yeradon; 07-21-2016 at 05:03.
Yeradon is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 07-21-2016 , 05:02   Re: Gameserver Chat to Browser
Reply With Quote #30

@Yeradon
Quote:
Sockets might be the best way for a realtime application
Amen.

I know how to do the sourcemod part, but I have found nothing usefull for the PHP socket part, mind to teach me how you would do it ?
__________________
Want to check my plugins ?

Last edited by Arkarr; 07-21-2016 at 05:03.
Arkarr is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode