Receiving_Messages - HerobrinesArmy/ChatInterfaces GitHub Wiki

Getting messages from the chat server is done through HTTP GET requests to http://herobrinesarmy.com/update_chat2.php. You will need to follow an HTTP redirect if you actually want to get the messages from the request. All data is returned as JSON. The server uses long polling, which means that if there are no new messages the server will wait to send a response until there is new data to send.

Request Parameters

"c": This is the number of the chat room which you would like to get messages from. The meeting room is "3" and the main chat is "8613406"

"l": This is the last message id (lmid), and on first request should be set to zero. After that, it should be set to the lmid value returned by the last request in the json response. This should never be left out, as leaving it out wastes huge amounts of server bandwidth.

"p": Setting p to "0" means that the server will not parse bbcode into HTML, and also lowers server load. DCPU chat uses the server with p set to "0". It is generally a good idea to use this mode with chat clients.

In addition to the request parameters listed above, you will want to be sure to send your cookie (which you received while authenticating) with every request. It is not possible to receive messages without being logged in.

Example Using Curl

curl -m 60 -s -L -b cookie -c cookie "http://herobrinesarmy.com/update_chat2.php?c=8613406&l=0&p=0"

"-m 60" means to set a 60 second timeout (helps if there is ever a network failure so curl does not hang).

"-L" means to follow redirects. Without this you would get no useful information from the server.

"c=8613406" means to request from the main chat room.

"l=0" means to return the last ~50 messages from the server, and is required for the first request since you do not yet know the lmid value. After the first request do not use "l=0", instead replace "0" with the lmid returned by the previous response.

"p=0" simply means to not parse messages. Messages generally should only be parsed by the server for the web chat.

Example JSON Response

Below is an example JSON response from the server from the curl request shown above.

({"success":"true","new":"true","lmid":"515031","seconds":"0.00012898445129395","messages":{"514982":{"message_id":"514982","user_id":"3768975","user":"<span class='rank p_o4' title='p_o4'><\/span><a href='\/profile\/3768975' class='element_username tag-228361'>awesome514982<\/a>","message":"even if enjin is down","time":"16:47:19"},"514983":{"message_id":"514983","user_id":"3768975","user":"<span class='rank p_o4' title='p_o4'><\/span><a href='\/profile\/3768975' class='element_username tag-228361'>awesome514983<\/a>","message":"which is most of the time","time":"16:47:33"},"514984":{"message_id":"514984","user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","message":"OH FUCK","time":"16:47:41"},"514985":{"message_id":"514985","user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","message":"NO TELL ME WHAT HAPPEN","time":"16:47:45"},"514986":{"message_id":"514986","user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","message":"I NO SAW","time":"16:47:49"},"514987":{"message_id":"514987","user_id":"4055211","user":"<span class='rank p_e1' title='p_e1'><\/span><a href='\/profile\/4055211' class='element_username tag-228361'>Jeremy Wildsmit<\/a>","message":"HB has his own servers doesn't he? Can't he just host a small IRC server?","time":"16:47:53"},"514988":{"message_id":"514988","user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","message":"He has this chat","time":"16:48:04"},"514989":{"message_id":"514989","user_id":"3768975","user":"<span class='rank p_o4' title='p_o4'><\/span><a href='\/profile\/3768975' class='element_username tag-228361'>awesome514989<\/a>","message":"^","time":"16:48:07"},"514990":{"message_id":"514990","user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","message":"It's doesn't use enjin except to host the page","time":"16:48:28"},"514991":{"message_id":"514991","user_id":"3768975","user":"<span class='rank p_o4' title='p_o4'><\/span><a href='\/profile\/3768975' class='element_username tag-228361'>awesome514991<\/a>","message":"If it aint broke, don't fix it!","time":"16:48:28"},"514992":{"message_id":"514992","user_id":"4055211","user":"<span class='rank p_e1' title='p_e1'><\/span><a href='\/profile\/4055211' class='element_username tag-228361'>Jeremy Wildsmit<\/a>","message":"oh I see","time":"16:48:43"},"514993":{"message_id":"514993","user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","message":"Also","time":"16:49:19"},"514994":{"message_id":"514994","user_id":"3768975","user":"<span class='rank p_o4' title='p_o4'><\/span><a href='\/profile\/3768975' class='element_username tag-228361'>awesome514994<\/a>","message":"unlike IRC, this is directly integrated with our forum accounts","time":"16:49:31"},"514995":{"message_id":"514995","user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","message":"You can use herobrinesarmy.com\/zoidberg with your enjin session.","time":"16:49:32"},"514996":{"message_id":"514996","user_id":"4055211","user":"<span class='rank p_e1' title='p_e1'><\/span><a href='\/profile\/4055211' class='element_username tag-228361'>Jeremy Wildsmit<\/a>","message":"does lettice implement the M35FD spec?","time":"16:49:48"},"514997":{"message_id":"514997","user_id":"4055211","user":"<span class='rank p_e1' title='p_e1'><\/span><a href='\/profile\/4055211' class='element_username tag-228361'>Jeremy Wildsmit<\/a>","message":"lettuce*","time":"16:49:52"},"514998":{"message_id":"514998","user_id":"3768975","user":"<span class='rank p_o4' title='p_o4'><\/span><a href='\/profile\/3768975' class='element_username tag-228361'>awesome514998<\/a>","message":"Doesn't it not?","time":"16:50:18"},"514999":{"message_id":"514999","user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","message":"It does","time":"16:50:35"},"515000":{"message_id":"515000","user_id":"3768975","user":"<span class='rank p_o4' title='p_o4'><\/span><a href='\/profile\/3768975' class='element_username tag-228361'>awesome515000<\/a>","message":"not very well though","time":"16:51:33"},"515001":{"message_id":"515001","user_id":"4055211","user":"<span class='rank p_e1' title='p_e1'><\/span><a href='\/profile\/4055211' class='element_username tag-228361'>Jeremy Wildsmit<\/a>","message":"whats wrong w\\ it?","time":"16:52:03"},"515002":{"message_id":"515002","user_id":"3768975","user":"<span class='rank p_o4' title='p_o4'><\/span><a href='\/profile\/3768975' class='element_username tag-228361'>awesome515002<\/a>","message":"it keeps the drive busy when it's not supposed to be","time":"16:52:17"},"515003":{"message_id":"515003","user_id":"4055211","user":"<span class='rank p_e1' title='p_e1'><\/span><a href='\/profile\/4055211' class='element_username tag-228361'>Jeremy Wildsmit<\/a>","message":":S","time":"16:52:27"},"515004":{"message_id":"515004","user_id":"4055211","user":"<span class='rank p_e1' title='p_e1'><\/span><a href='\/profile\/4055211' class='element_username tag-228361'>Jeremy Wildsmit<\/a>","message":"sounds like an annoying problem","time":"16:52:47"},"515005":{"message_id":"515005","user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","message":"Well","time":"16:52:50"},"515006":{"message_id":"515006","user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","message":"It only does that when you call it with an out of bounds sector number","time":"16:53:03"},"515007":{"message_id":"515007","user_id":"3768975","user":"<span class='rank p_o4' title='p_o4'><\/span><a href='\/profile\/3768975' class='element_username tag-228361'>awesome515007<\/a>","message":"Why would you ever do that?","time":"16:53:18"},"515008":{"message_id":"515008","user_id":"2502875","user":"<a href='\/profile\/2502875' class='element_username tag-232043'>nathan65542<\/a>","message":"I haz wut wut","time":"16:54:19"},"515009":{"message_id":"515009","user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","message":"accident","time":"16:54:26"},"515010":{"message_id":"515010","user_id":"3768975","user":"<span class='rank p_o4' title='p_o4'><\/span><a href='\/profile\/3768975' class='element_username tag-228361'>awesome515010<\/a>","message":":stare:","time":"16:54:36"},"515011":{"message_id":"515011","user_id":"3768975","user":"<span class='rank p_o4' title='p_o4'><\/span><a href='\/profile\/3768975' class='element_username tag-228361'>awesome515011<\/a>","message":"latah","time":"16:55:56"},"515012":{"message_id":"515012","user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","message":"turns out the drive doesn't respond well when you ask if for sector 0xffff","time":"16:55:56"},"515013":{"message_id":"515013","user_id":"2063911","user":"<a href='\/profile\/2063911' class='element_username tag-223534'>Herobrine<\/a>","message":"It isn't Enjin that limits name length in chat; it's ,e.","time":"17:18:19"},"515014":{"message_id":"515014","user_id":"2063911","user":"<a href='\/profile\/2063911' class='element_username tag-223534'>Herobrine<\/a>","message":"*me.","time":"17:18:21"},"515015":{"message_id":"515015","user_id":"4055211","user":"<span class='rank p_e1' title='p_e1'><\/span><a href='\/profile\/4055211' class='element_username tag-228361'>Jeremy Wildsmit<\/a>","message":"can you add one character to the limit?","time":"17:20:25"},"515016":{"message_id":"515016","user_id":"2063911","user":"<a href='\/profile\/2063911' class='element_username tag-223534'>Herobrine<\/a>","message":"Yes, I can.","time":"17:20:34"},"515017":{"message_id":"515017","user_id":"2063911","user":"<a href='\/profile\/2063911' class='element_username tag-223534'>Herobrine<\/a>","message":"Then again, there are many things I can do.","time":"17:21:25"},"515018":{"message_id":"515018","user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","message":"Please do it.","time":"17:23:27"},"515019":{"message_id":"515019","user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","message":":sigh:","time":"17:48:19"},"515020":{"message_id":"515020","user_id":"4055211","user":"<span class='rank p_e1' title='p_e1'><\/span><a href='\/profile\/4055211' class='element_username tag-228361'>Jeremy Wildsmit<\/a>","message":"How to place breakpoints in DevKit: Fill breakpoings in a 5 line radius of the line you wish to break on and pray to god you actually break on one of them.","time":"17:54:44"},"515021":{"message_id":"515021","user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","message":"O:","time":"17:55:51"},"515022":{"message_id":"515022","user_id":"2502875","user":"<a href='\/profile\/2502875' class='element_username tag-232043'>nathan65542<\/a>","message":"Back again from the forums","time":"18:03:58"},"515023":{"message_id":"515023","user_id":"2502875","user":"<a href='\/profile\/2502875' class='element_username tag-232043'>nathan65542<\/a>","message":"Hello all","time":"18:04:00"},"515024":{"message_id":"515024","user_id":"2502875","user":"<a href='\/profile\/2502875' class='element_username tag-232043'>nathan65542<\/a>","message":"What shouldn't be dead D:","time":"18:06:01"},"515025":{"message_id":"515025","user_id":"2310353","user":"<span class='rank f_o8' title='f_o8'><\/span><a href='\/profile\/2310353' class='element_username tag-228677'>Liraal<\/a>","message":"heya","time":"18:07:24"},"515026":{"message_id":"515026","user_id":"2310353","user":"<span class='rank f_o8' title='f_o8'><\/span><a href='\/profile\/2310353' class='element_username tag-228677'>Liraal<\/a>","message":"why no DST, chat timer?","time":"18:07:54"},"515027":{"message_id":"515027","user_id":"2502875","user":"<a href='\/profile\/2502875' class='element_username tag-232043'>nathan65542<\/a>","message":"What?","time":"18:08:22"},"515028":{"message_id":"515028","user_id":"2310353","user":"<span class='rank f_o8' title='f_o8'><\/span><a href='\/profile\/2310353' class='element_username tag-228677'>Liraal<\/a>","message":"daylight saving time","time":"18:08:38"},"515029":{"message_id":"515029","user_id":"2502875","user":"<a href='\/profile\/2502875' class='element_username tag-232043'>nathan65542<\/a>","message":"Idk","time":"18:10:08"},"515030":{"message_id":"515030","user_id":"2063911","user":"<a href='\/profile\/2063911' class='element_username tag-223534'>Herobrine<\/a>","message":"Breakpoints aren't reliable in DevKit? :?","time":"18:10:12"},"515031":{"message_id":"515031","user_id":"2310353","user":"<span class='rank f_o8' title='f_o8'><\/span><a href='\/profile\/2310353' class='element_username tag-228677'>Liraal<\/a>","message":"was there some new game-related info lately?","time":"18:11:24"}},"users":{"2063911":{"user_id":"2063911","user":"<a href='\/profile\/2063911' class='element_username tag-223534'>Herobrine<\/a>","muted":"false"},"2502875":{"user_id":"2502875","user":"<a href='\/profile\/2502875' class='element_username tag-232043'>nathan65542<\/a>","muted":"false"},"2204141":{"user_id":"2204141","user":"<span class='rank s_o6' title='s_o6'><\/span><a href='\/profile\/2204141' class='element_username tag-228361'>Kitcat490<\/a>","muted":"false"},"1832897":{"user_id":"1832897","user":"<a href='\/profile\/1832897' class='element_username tag-228080'>Noblearcher<\/a>","muted":"false"},"3474118":{"user_id":"3474118","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3474118' class='element_username tag-228361'>Lucus<\/a>","muted":"false"},"2310353":{"user_id":"2310353","user":"<span class='rank f_o8' title='f_o8'><\/span><a href='\/profile\/2310353' class='element_username tag-228677'>Liraal<\/a>","muted":"false"},"3675626":{"user_id":"3675626","user":"<span class='rank p_e4' title='p_e4'><\/span><a href='\/profile\/3675626' class='element_username tag-228361'>LukeW4lker<\/a>","muted":"false"},"1352555":{"user_id":"1352555","user":"<span class='rank a_e2' title='a_e2'><\/span><a href='\/profile\/1352555' class='element_username tag-228373'>linkolead<\/a>","muted":"false"},"4055211":{"user_id":"4055211","user":"<span class='rank p_e1' title='p_e1'><\/span><a href='\/profile\/4055211' class='element_username tag-228361'>Jeremy Wildsmit<\/a>","muted":"false"},"769889":{"user_id":"769889","user":"<span class='rank p_e1' title='p_e1'><\/span><a href='\/profile\/769889' class='element_username tag-228361'>Nexus\u00c2<\/a>","muted":"false"}}})
⚠️ **GitHub.com Fallback** ⚠️