Jeffrey Gelens avatar Jeffrey Gelens committed 9c97b7e

Renamed recv to receive in old websocket class

Comments (0)

Files changed (3)

examples/websocket.html

 var iets = "";
 window.onload = function() {
     var data = {};
-    //var s = new MozWebSocket("ws://localhost:8000/data");
-    var s = new WebSocket("ws://localhost:8000/data");
+	try {
+		var s = new WebSocket("ws://localhost:8000/data");
+	}
+	catch (e) {
+		var s = new MozWebSocket("ws://localhost:8000/data");
+	}
     s.onopen = function() {
         //alert('open');
         s.send('hi');

geventwebsocket/handler.py

         protocol, version = self.request_version.split("/")
         key = environ.get("HTTP_SEC_WEBSOCKET_KEY")
 
-        print key
-
         # check client handshake for validity
         if not environ.get("REQUEST_METHOD") == "GET":
             # 5.2.1 (1)
     def _handle_one_legacy_response(self):
         # In case the client doesn't want to initialize a WebSocket connection
         # we will proceed with the default PyWSGI functionality.
-        print self.environ.get("HTTP_CONNECTION", "").lower().split(",")
 
         if "upgrade" in self.environ.get("HTTP_CONNECTION", "").lower(). \
              replace(" ", "").split(",") and \

geventwebsocket/websocket.py

 
         return ''.join(bytes)
 
-    def wait(self):
+    def receive(self):
         while True:
             if self.websocket_closed:
                 return None
         opcode -- the opcode to use (default OPCODE_TEXT)
         """
 
-
         if self.websocket_closed:
             raise Exception('Connection was terminated')
 
 
 
     def close(self, reason, message):
-        """Close the websocket, sending the specified reason and message
-        """
+        """Close the websocket, sending the specified reason and message"""
 
         message = self._encode_text(message)
         self.send(struct.pack('!H%ds' % len(message), reason, message), opcode=self.OPCODE_CLOSE)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.