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

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-19-2016 , 20:09   Re: Gameserver Chat to Browser
Reply With Quote #11

Quote:
Originally Posted by Deathknife View Post
Why not insert messages into MySQL(either directly or http requests) and then just load the messages on web page with auto-refresh using jquery/ajax?
Bad practice I guess.
__________________
Arkarr is offline
Deathknife
Senior Member
Join Date: Aug 2014
Old 07-19-2016 , 21:06   Re: Gameserver Chat to Browser
Reply With Quote #12

Quote:
Originally Posted by Arkarr View Post
Bad practice I guess.
Storing messages in mysql? A lot of shoutboxes work that way, otherwise you could really only see messages from the time you opened it.
__________________
Deathknife is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 07-20-2016 , 01:00   Re: Gameserver Chat to Browser
Reply With Quote #13

Quote:
Originally Posted by Arkarr View Post
Quote:
Originally Posted by Deathknife View Post
Why not insert messages into MySQL(either directly or http requests) and then just load the messages on web page with auto-refresh using jquery/ajax?
Bad practice I guess.
Well, I'm also very curious about this one...

You seriously have to explain your "bad practice"!

It would be the most obvious way to do it:

- SourceMod plugin inserting data (e.g. steamid, message, playername, etc) into SQL.
- PHP (API) fetching directly from the database
- Some sort of jquery/ajax can indeed be used to update things, by selecting stuff that's newer than what's in the browser already.
__________________
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 , 05:24   Re: Gameserver Chat to Browser
Reply With Quote #14

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.
__________________

Last edited by Arkarr; 07-20-2016 at 05:26.
Arkarr is offline
mazdarx8
Veteran Member
Join Date: Aug 2014
Old 07-20-2016 , 05:27   Re: Gameserver Chat to Browser
Reply With Quote #15

Yes like here:
https://www.saigns.de/

I dont have experience in that, I am using xenForo.
mazdarx8 is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 07-20-2016 , 06:54   Re: Gameserver Chat to Browser
Reply With Quote #16

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.
It appears to be "I guess" to everything. Are you sure? :p

Quote:
Originally Posted by Arkarr View Post
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.
I can't seem to figure out the reasons to your claims about being slower either.

Assuming everything goes well, the database will be updated almost insantly with the SQL queries from the SourceMod plugin.

How you choose to update your website is another thing, but you can make jquery/ajax calls do it every second if you like. As quite a few javascripts uses setTimeout(), which are in miliseconds, you can probably do it way faster if you like... It's your call.

Quote:
Originally Posted by Arkarr View Post
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.
We all have different point of views, sharing them for each other makes sense, as we can learn from each other that way.
__________________
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 , 07:01   Re: Gameserver Chat to Browser
Reply With Quote #17

Quote:
Originally Posted by arne1288 View Post
It appears to be "I guess" to everything. Are you sure? :p
Absoluty not. But I'm diggging the subject right now.

EDIT : Using database in this case just doesn't sounds right to me.
__________________

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

Quote:
Originally Posted by mazdarx8 View Post
Yes like here:
https://www.saigns.de/

I dont have experience in that, I am using xenForo.
That one queries https://www.saigns.de/api_serverlog.php every 1.5 second (1500 ms), that outputs the content the "chat" area will be replaced with on success.

If it fails the query for some reason, it will wait for 5 seconds (5000 ms) before next query.

The whole system at http://serverlog.saigns.de/ seems in my opinion to confirm even more that they are most likely selecting their data from a database.

Are you running HLstatsX:CE, or anything similar? HLstatsX.CE keeps the past 28 days of chat logs per default, so if you do, you might already have the chat logging that you could simply fetch out from that database.
__________________
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 , 07:16   Re: Gameserver Chat to Browser
Reply With Quote #19

@arne1288
Still doesn't mean it's the best solution.
__________________
Arkarr is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 07-20-2016 , 07:30   Re: Gameserver Chat to Browser
Reply With Quote #20

Quote:
Originally Posted by Arkarr View Post
Still doesn't mean it's the best solution.
I never said it was the best solution:

But including a million different things to accomplish a very simple goal doesn't sound to be the best solution either, especially when this simple goal just requires 3 out of the 1 million things that your suggestion would requires.

How on earth can that be the best solution?

A car that normally has 4 tyres doesn't necessarily drive better because you manage to fit 8 tyres onto it.
__________________
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
Reply


Thread Tools
Display Modes

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:11.


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