JavaScript - Server To Server Connection (with Clients) ?
I need help to make a Server to server connection
I already have a server connected to clients, clients send msgs and it echoes back to all of them and now i want when a client sends a msg it echoes on his server and the other server too .. so when any of the clients on any of the servers sends a msg it is broadcasted all over the servers to all clients This is my SERVER code Code: import java.io.*; import java.net.*; public class MultiThreadChatServer { // Declaration section: This part to declare the server socket, client // socket, input stream // and output stream static Socket clientSocket = null; static ServerSocket serverSocket = null; // server can hold up to 10 clients static clientThread t[] = new clientThread[10]; public static void main(String args[]) { int port_number = 6000; if (args.length < 1) { System.out.println("Server Started \n" + "Now using port number=" + port_number); } else { port_number = Integer.valueOf(args[0]).intValue(); } // Initialization section: Where I try to open a server socket on the // given port try { serverSocket = new ServerSocket(port_number); } catch (IOException e) { System.out.println(e); } // Create a socket object from the ServerSocket to listen and accept // connections // Open input and output streams for this socket will be created in // client's thread since every client is served by the server in // an individual thread while (true) { try { clientSocket = serverSocket.accept(); for (int i = 0; i <= 9; i++) { if (t[i] == null) { (t[i] = new clientThread(clientSocket, t)).start(); break; } } } catch (IOException e) { System.out.println(e); } } } } // This client thread opens the input and the output streams for a particular // client, // ask the client's name, informs all the clients currently connected to the // server about the fact that a new client has joined the chat room, // and as long as it receive data, echos that data back to all other clients. // When the client leaves the chat room this thread informs also all the // clients about that and terminates. class clientThread extends Thread { DataInputStream is = null; PrintStream os = null; Socket clientSocket = null; clientThread t[]; public clientThread(Socket clientSocket, clientThread[] t) { this.clientSocket = clientSocket; this.t = t; } public void run() { String line; String name; try { is = new DataInputStream(clientSocket.getInputStream()); os = new PrintStream(clientSocket.getOutputStream()); os.println("Enter your name."); name = is.readLine(); os.println("Hello " + name + " you can now start chatting with all the connected chat-mates"); for (int i = 0; i <= 9; i++) if (t[i] != null && t[i] != this) t[i].os.println(".." + name + " has entered the chat room .."); while (true) { line = is.readLine(); if (line.startsWith("/quit")) break; for (int i = 0; i <= 9; i++) if (t[i] != null) t[i].os.println("<" + name + "> " + line); } for (int i = 0; i <= 9; i++) if (t[i] != null && t[i] != this) t[i].os.println("" + name + " has left the chat room .."); os.println("Bye " + name + " .."); // Clean up: // Set to null the current thread variable such that other client // could // be accepted by the server for (int i = 0; i <= 9; i++) if (t[i] == this) t[i] = null; // close the output stream // close the input stream // close the socket is.close(); os.close(); clientSocket.close(); } catch (IOException e) { } ; } } Similar TutorialsI have the following JavaScript (see below). The script requests an XML file from the server and displays it on the page. The script works fine when the requested XML file is stored on the same server as the script. The problem is when I try requesting an XML file from an external server such as the National Weather Service. I get an error. If I take the XML file from the National Weather Service and save it to my server it works. Why can't I use my script to request XML files stored on external servers? Thanks in advance for any help. Javascript Code Code: window.onload = initAll; var xhr = false; function initAll() { document.getElementById("makeTextRequest").onclick = getNewFile; document.getElementById("makeXMLRequest").onclick = getNewFile; } function getNewFile() { makeRequest(this.href); return false; } function makeRequest(url) { if (window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else { if (window.ActiveXObject) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { } } } if (xhr) { xhr.onreadystatechange = showContents; xhr.open("GET", url, true); xhr.send(null); } else { document.getElementById("updateArea").innerHTML = "Sorry, but I couldn't create an XMLHttpRequest"; } } function showContents() { if (xhr.readyState == 4) { if (xhr.status == 200) { if (xhr.responseXML && xhr.responseXML.contentType=="text/xml") { var outMsg = xhr.responseXML.getElementsByTagName("choices")[0].textContent; } else { var outMsg = xhr.responseText; } } else { var outMsg = "There was a problem with the request " + xhr.status; } document.getElementById("updateArea").innerHTML = outMsg; } } HTML Code Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>My First Ajax Script</title> <script type="text/javascript" src="script01.js"></script> </head> <body> <p><a id="makeXMLRequest" href="http://www.weather.gov/xml/current_obs/KOJC.xml">Request an XML file</a></p> <div id="updateArea"> </div> </body> </html> At the moment I have an exchange server which enables shared calendars. I would like to use Javascript to write to a shared calendar i.e. add a event. Can this be done? I recently coded a page that extracts certain nodes from an external XML file and prints a line of text on the webpage. It is an HTML page that is strictly devoted to this purpose. There is no other information on it. The page is currently stored locally on my computer, and when I open it, the script runs fine and outputs the correct text. However, when I transferred this script over to my web server, and locate it that way, it doesn't run correctly. When I go to the page, it is supposed to display a line of text at the top. It does when I run the file from my local machine, however when I open it from the server, it doesn't display this text. (Same browser, same computer) When I right-click and view the source, all the code is there, and the files are identical. Any idea as to why the script runs correctly only when I open the HTML page locally? I appreciate any help or advice. Thanks! Hi, I am trying to access an XML file from a server in my JavaScript code. I have an XML file like this: -<stream version="1.2"> -<room id="simulator" time="128168557915"> -<dimention id=0 x="1.25" y="2.00"> <m mcu="160" sid="75"> </dimention> </room> -<room id="simulator" time="128168557928"> -<dimention id=0 x="1.95" y="1.86"> <m mcu="160" sid="55"> </dimention> </room> </stream> this file is generated by an application and I can access it from a URL ( since I am using the simulator for this application the XML is accessible from http://localhost:8081/feed/demo) This xml file is updated every few seconds and constantly growing. I have a javascript code which I've added the following code to it in order to use the data from XML file: <script type="text/javascript"> if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET","http://localhost:8081/feed/demo",false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; document.write("<table border='1'>"); var x=xmlDoc.getElementsByTagName("room"); for (i=0;i<x.length;i++) { document.write("<tr><td>"); document.write(xmlDoc.getElementsByTagName("dimention")[i].getAttribute("x")); document.write("</td><td>"); } document.write("</table>"); </script> Now here comes my problem: if I have the XML file saved on same drive as html page and I address it like this: xmlhttp.open("GET","floor.xml",false); it works fine, but when I pass the URL it doesn't. is there anything else I should do in case of loading the xml from URL? my second question is that I want to use the text values returned by xmlDoc.getElementsByTagName("dimention")[i].getAttribute("x") in an if statement like this : if (valuereturned = 2.00) { do sth } what is the best way to do that, since the returned value is a text. I need the answer ASAP and I really appreciate your help, thanx :-) Hi Chaps, I have JavaScript code, that exports a HTML table to MS Excel. This works fine on my development (local) server, however, it fails to work on my 'live' IIS server. Once I click on the Export link, I confirm the "Export to Microsoft Excel?" message, then nothing happens. I am not sure if MS Excel needs to be installed on the server or not? If anyone has any ideas, I'd be most grateful: Code: <script language="javascript" type="text/javascript"> function ExportToExcel() { input_box=confirm("Export to Microsoft Excel?"); if (input_box==true) { var xlApp = new ActiveXObject("Excel.Application"); // Silent-mode: xlApp.Visible = true; xlApp.DisplayAlerts = false; var xlBook = xlApp.Workbooks.Add(); xlBook.worksheets("Sheet1").activate; var XlSheet = xlBook.activeSheet; XlSheet.Name="Report"; // Store the sheet header names in an array var rows = tblrepeat.getElementsByTagName("tr"); var columns = tblrepeat.getElementsByTagName("th"); var data = tblrepeat.getElementsByTagName("td"); // Set Excel Column Headers and formatting from array for(i=0;i<columns.length;i++){ XlSheet.cells(2).value= "Projects - All"; XlSheet.cells(3,i+1).value= columns[i].innerText; //XlSheetHeader[i]; XlSheet.cells(3,i+1).font.color="6"; XlSheet.cells(3,i+1).font.bold="true"; XlSheet.cells(3,i+1).interior.colorindex="37"; XlSheet.Range("A1:B1000").HorizontalAlignment = -4131; } //run over the dynamic result table and pull out the values and insert into corresponding Excel cells var d = 0; for (r=4;r<rows.length+3;r++) { // start at row 2 as we've added in headers - so also add in another row! for (c=1;c<columns.length+1;c++) { XlSheet.cells(r,c).value = data[d].innerText; d = d + 1; } } //autofit the columns XlSheet.columns.autofit; // Make visible: xlApp.visible = true; xlApp.DisplayAlerts = true; CollectGarbage(); //xlApp.Quit(); } } </script> Ok my lab6 at http://opentech.durhamcollege.ca/~in...rittains/labs/ is conflicting with my interface as it is php... is there a better way for me to do this that will allow it to not conflict? PHP Code: <?php $title = "Lab6"; include "head.php"; ?> <style type="text/css"> table, td, th { border: 1px solid red; } </style> <?php function convert($i) { $CtoF= 9.0/5.0*$i + 32; return $CtoF; } ?> <td> <?php $error = ""; $result = ""; if($_SERVER["REQUEST_METHOD"] == "GET") { $start = ""; $stop = ""; $increment = ""; } else if($_SERVER["REQUEST_METHOD"] == "POST") { $start = trim($_POST["startTemp"]); $stop = trim($_POST["stopTemp"]); $increment = trim($_POST["incrementTemp"]); if(!isset($start) || $start == "") { $error .= "<br/>Please enter number to declare a starting value."; } else if(!is_numeric($start)) { $error .= "<br/>The value entered <b>MUST</b> be a number, you entered: " . $start; $start = ""; } if(!isset($stop) || $stop == "") { $error .= "<br/>Please enter number to declare a ending value."; } else if(!is_numeric($stop)){ $error .= "<br/>The value entered <b>MUST</b> be a number, you entered: " . $stop; $stop = ""; } if(!isset($increment) || $increment == "") { $error .= "<br/>Please enter number to declare a increment value."; } else if(!is_numeric($increment)){ $error .= "<br/>The value entered <u>MUST</u> be a number, you entered: " . $increment; $increment = ""; } if($error == "") { $result .= "<table class='phpTable'>"; $result .= "<tr><th>Celsius</th>"; $result .= "<th>Fahrenheit</th></tr>"; for ($i = $start; $i <= $stop; $i += $increment) { $result .= "<tr><td>" . $i; $result .= "°</td><td>"; $result .= convert($i); $result .= "°</td></tr>"; } $result .= "</table>"; } else { $error .= "<br/>Please Try Again"; } } ?> <script type="text/javascript"> /*var error = "<?php echo $error; ?>"; document.getElementById('error').innerHTML = error; var result = "<?php echo $result; ?>"; document.getElementById('result').innerHTML = result;*/ </script> <h2 id="error"><?php echo $error; ?></h2> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" > Starting Temperatu <input type="text" name="startTemp" value="<?php echo $start; ?>" size="5"/> <br/> Stop Temperatu <input type="text" name="stopTemp" value="<?php echo $stop; ?>" size="5"/> <br/> Temperature Increment: <input type="text" name="incrementTemp" value="<?php echo $increment; ?>" size="5"/> <br/> <input type="submit" name="submit" value="Submit"/> </form> <h2 id="result"><?php echo $result; ?></h2> <?php include "foot.php"; ?> The assignment was supposed to be done in PHP. But I want to know if there is a better way either way. Like can I use AJAX instead of PHP to do that? or change the way the PHP works... something anything... if the proxy is an intermediary between the client and the requested url could that url be sent to two different clients in response? so in stead of this [client]<-->[proxy]<-->[website] it would be this [client1]<-->[proxy]<-->[website] .................. / ...........[client2] meaning if [client1] requests "google.com" on the proxy server the proxy server will request "google.com" and send it back to [client1] as well as [client2] it would just be url sharing between two people, like a real time delicious.com heya, ^.^ sorry if this is in the wrong section, im new here so i wasn't sure as it concerns both java and php, so basically i've made a website that pings a server address when someone views the site, but currently it will ping every time you f5 or refresh ect, what i need it to do is only ping once every 2mins, store the value for when its not being pinged to be displayed, now i got told this could be done in javascript?, but my knowledge of javascript is very minimal, i also got told that "var m_pingDomain_timer = setInterval(dopingDomain, 120);" may have something to do with it?, and help /code or pointers in the right direction would be a great help , il leave you with the PHP code so you can look over below Code: <tr> <td class="SEBody1"> <?php // Function to check response time error_reporting(0); function pingDomain($domain) { $starttime = microtime(true); $file = fsockopen ($domain, 80, $errno, $errstr, 10); $stoptime = microtime(true); $status = 0; if (!$file) $status = -1; // Site is down else { fclose($file); $status = ($stoptime - $starttime) * 1000; $status = floor($status); } return $status; } echo '<table>'; $domainbase ="google.com"; $status = pingDomain($domainbase); if ($status != -1) echo "<img src='img/shard_status_online.png' width='18' height='18' alt='Online' />Online"; else echo "<img src='img/shard_status_offline.png' width='18' height='18' alt='Offline' />Offline"; echo '</table>'; ?> </td> <td class="SEBody1">로그인</td> <td class="SEBody1">Login</td> <td class="SEBody1"> <?php if ($status !=-1) echo "$status ms"; else echo "0 ms"; ?> </td> </tr> I have a google blogger site on which I want to run a PHP script. The problem is that blogger doesn't have a PHP interpreter. So I was thinking, can I run the php file on a remote server that supports php, and load the result in a div in blogger? Thx! Hi, I am hosting my website in free server (freehostia.com) and i am using joomla1.5 . I want to parse RSS from my other websites. Joomla does it with its modules. But the server do not allow outbound HTTP request, hence i had use rss-to-javascript website to parse RSS feeds. It parses well but there is its advertisement below the feed (which i think is nonsense). The link it provides is in the format of <script src="http://somethin.com/somdfile.php?parse=.."></script> when i put the link in my browser i see following document.write("string of my parsed xml file with advertisement at end"); What i want to do is get the sting of above line and edit it to chop off the end advertisement. if there was any method to load that output sting in any variable, the task would had been completed. If anybody knows how to do it, please help me. I must make clear that I am not a javascript programmer; I am simply trying to get this script to work on my website. It functions perfectly locally (with all browsers), but after uploading to my website, it shows the controls at the top, but not the content. Below is the code for the FreeMind Flash Browser which can be found he http://freemind.sourceforge.net/wiki.../Flash_browser It requires 2 additional files, flashobject.js and visorFreemind.swf plus the FreeMind file (*.mm) that stores the content. The FreeMind file that has the content displays perfectly on localhost, but not on the website. I have all of these files in the same directory and have double checked everything, but it still doesn't function on my website. I have other flash files and scripts on the same website in other pages that function perfectly. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="freemind flash browser"/> <meta name="keywords" content="freemind,flash"/> <title>MINDMAPS</title> <script type="text/javascript" src="flashobject.js"></script> <style type="text/css"> /* hide from ie on mac \*/ html { height: 100%; overflow: hidden; } #flashcontent { height: 100%; } /* end hide */ body { height: 100%; margin: 0; padding: 0; background-color: #9999ff; } </style> <script language="javascript"> function giveFocus() { document.visorFreeMind.focus(); } </script></head> <body onLoad="giveFocus();"> <div id="flashcontent" onmouseover="giveFocus();"> Flash plugin or Javascript are turned off. Activate both and reload to view the mindmap </div> <script type="text/javascript"> // <![CDATA[ // for allowing using http://.....?mindmap.mm mode function getMap(map){ var result=map; var loc=document.location+''; if(loc.indexOf(".mm")>0 && loc.indexOf("?")>0){ result=loc.substring(loc.indexOf("?")+1); } return result; } var fo = new FlashObject("visorFreemind.swf", "visorFreeMind", "100%", "100%", 6, "#9999ff"); fo.addParam("quality", "high"); fo.addParam("bgcolor", "#a0a0f0"); fo.addVariable("openUrl", "_blank"); fo.addVariable("startCollapsedToLevel","3"); fo.addVariable("maxNodeWidth","200"); // fo.addVariable("mainNodeShape","elipse"); fo.addVariable("justMap","false"); fo.addVariable("initLoadFile",getMap("blues.mm")); fo.addVariable("defaultToolTipWordWrap",200); fo.addVariable("offsetX","left"); fo.addVariable("offsetY","top"); fo.addVariable("buttonsPos","top"); fo.addVariable("min_alpha_buttons",20); fo.addVariable("max_alpha_buttons",100); fo.addVariable("scaleTooltips","false"); fo.write("flashcontent"); // ]]> </script> </body> </html> Hello again... I have written a custom slideshow script which gets the images from an array... The script will change the src of a img, which is a fullscreen background. Now here's the problem, I've been trying to write a function where can define a folder "gallery\test\", and then get all image files in that folder and repopulate the slideshow array. So, is there a way to scan folders? I've searched around and found some solutions where PHP is used, but i really want to keep this pure js, if possible (?) Thanks, I have trying to save an update the xml file which is there in same folder in which HTML page is there. In HTMl page i have written javascript code to Save and Update XML on server.The code is like this Code: function Save() { var xmlDoc= new ActiveXObject("MSXML.DOMDocument") xmlDoc.async="false" xmlDoc.load("/show/Share%20Workspace/Nidhi/Share%20%Document/Account.xml") //..code to modify xmlDoc xmlDoc.save ("/show/Share%20Workspace/Nidhi/Share%20%Document/Account.xml") xmlDoc = null; alert('Details saved'); } When i am accessing HTMl page on server from client and this function is called error 'Parameter is incorrect' is showing on line Code: xmlDoc.save ("/show/Share%20Workspace/Nidhi/Share%20%Document/Account.xml") Note: xmlDoc.load("/show/Share%20Workspace/Nidhi/Share%20%Document/Account.xml") is working fine. The save is working fine in local but not when on server and request from client. Kindly suggest me the possible solution to it. Hey. I'm currently looking for a countdown script, which is based on the server's time. I've only found scripts, that's based on the local computer's time, which means the output of the script changes, when the time on the computer is changed. And I want to make a public announcement which counts down to something - and should output the same at every person. I'm not that familiar with JavaScript, I know some jQuery - if anyone can supply any links or can help me with this, I'd appreciate it. Hello, I'm building a very simple app that relies on a remote server. I will use this app on many websites, so I decided to store it on one server (I have control of the remote server in question). I need to make sure that this server is up and running, so in the case it's not I can use a fallback. Would it be a client-side approach? A server-side approach? My guess is to use a js snippet to do the job. If I'm correct, I'll probably use jquery to perfom the task. Regards, -jj. Hi, I am trying to follow this tutorial and make a login feature for my apphttp://code.google.com/webtoolkit/do...unication.html to use GWT's remote procedure calls (RPC) to have server client communication to eventually make a web app that talks to a database. I thought I followed it exactly but when the async returns it fails and returns an exception: "com.google.gwt.user.client.rpc.InvocationException" Can someone please take a look at the client code, it must be something stupid that I am doing wrong. Thanks Here's the code: In the calling client class: Code: private MyServiceAsync svc = (MyServiceAsync) GWT.create(MyService.class); ((ServiceDefTarget)svc).setServiceEntryPoint(GWT.getModuleBaseURL()); //loginButtonListener btnDBLogin.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { svc.checkLogin(txtUsername.getText(),txtPassword.getText(), new AsyncCallback<Boolean>() { public void onSuccess(Boolean result) { if (result.booleanValue() == true) { System.out.println("Works"); } else { System.out.println("Invalid UserName or Password"); } } public void onFailure(Throwable ex) { System.out.println("FAILU " + ex.toString()); } });//end checkLogin }//end onCLICK });//endbtnlistener MyService.java (client interface) Code: package com.rob.projects.client; import com.google.gwt.user.client.rpc.RemoteService; public interface MyService extends RemoteService { public Boolean checkLogin(String userName, String password); } MyServiceImpl.java (server code) Code: package com.rob.projects.server; import com.rob.projects.client.MyService; import com.google.gwt.user.server.rpc.RemoteServiceServlet; public class MyServiceImpl extends RemoteServiceServlet implements MyService { private static final long serialVersionUID = 1L; public Boolean checkLogin(String userName, String password) { System.out.println(userName); if (userName.equalsIgnoreCase("bingo")) { // Check the database return true; } else return false; } } web.xml (to specify where the servlet is) PHP Code: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <!-- <servlet> path='MyService'class='com.rob.projects.server.MyServiceImpl' </servlet> --> <!-- Servlets --> <servlet> <servlet-name>MyServiceImpl</servlet-name> <servlet-class>com.rob.projects.server.MyServiceImpl</servlet-class> </servlet> <servlet-mapping> <servlet-name>MyServiceImpl</servlet-name> <url-pattern>/satapp</url-pattern> </servlet-mapping> <!-- Default page to serve --> <welcome-file-list> <welcome-file>SATapp.html</welcome-file> </welcome-file-list> </web-app> I have a server that when restarted emails from the code below every single time. I would like to know what I can use in the code below to regonize the restart and bypass the email send piece in BOLD below. Any help will be greatly appreciated. now = currentDateTime() if (statusInOverride != lastOverrideValue) or (overrideTime != lastOverrideTime) lastOverrideValue = statusInOverride lastOverrideTime = overrideTime if statusInOverride.value == true overrideStopTime = now overrideStopTime.minute = now.minute + overrideTime // Also send an email overrideHours = overrideTime / 60 mailSend(address, suiteName + " Overridden", suiteName + " has been overridden for " + overrideHours + " hours."); else mailSend(address, suiteName + " Override Canceled", suiteName + " has canceled their override. There was " + remainingTime + " remaining."); remainingTime.duration = 0 endif endif if statusInOverride.value == true remainingTime.duration = delta(now, overrideStopTime) endif Hello there, I am using Dynamic Drive's dhtml windowfile and when I had a link for it to call the popup window, it makes my site deliver a 500 server error. Here is the line of code I'm adding: Code: echo '<td><a class="link" href="#" onClick="ajaxwin=dhtmlwindow.open('ajaxbox', 'ajax', 'pages/post.php', 'Composing Mode: Post', 'width=650px,height=400px,left=300px,top=100px,resize=0,scrolling=1'); return false">Compose</a></td>'; It is not a php issue, I plaintext the link and it still did the same thing. Ok, so I consider myself to be fairly proficient with programming in general, although I am admittedly new to bi-directional networking. So here I am asking about methodological approaches. A non-disclosure clause prevents me from giving any details, but I don't think they would actually be pertinent. What is important is that the system must accept input from client side Javascript from many users and disseminate that input (once processed) to a number of users. In a way, think multi-channel chat system (totally different environment, but the mechanisms seem similar). As I see it, I have two options: periodic server polling, or server-sent events (compatibility with IE is not a requisite). So, my question is, which method (of these two or even something that I am not thinking of) is superior from the standpoint of server bandwidth? Periodic server polling obviously seems as if it would send a great many unneeded requests, but my hesitation for dismissing this method is that I don't see any client being idle for any considerable length of time (thus the client will send commands to the server quite often) and it simplifies my server software by delegating that section of logic (which data chunks need to be updated) to client CPU's. Additionally, I can throttle the update period based on server load. Server-sent events initially sounded like a great idea until I thought about the extreme likelihood of a large number of users (upwards of a hundred) interaction with the same chunk of data, thus requiring that each client receive an update every time another client does anything, which is likely once ever second or two, thus resulting in hundreds of updates being sent to hundreds of clients every second. Sounds similar to a denial of service situation to me. Anyway, I think I already know what I'm going to do for this project, but thought that this might be a good way to introduce myself to these forums. |