Browse Source

Updated go version to serve static assets

Also moved static assets up a directory
Mike Lewis 13 years ago
parent
commit
f8b18db1dd

+ 8 - 4
README.rst

@@ -16,7 +16,7 @@ It should work on OS X too.  There are no UIKit dependencies.
 
 
 .. Warning::
 .. Warning::
   This is not production-quality software yet.  It has only been used in
   This is not production-quality software yet.  It has only been used in
-  development environments.
+  devlopment environments.
   
   
   **USE AT YOUR OWN RISK**
   **USE AT YOUR OWN RISK**
 
 
@@ -42,7 +42,7 @@ There's a few options. Choose one, or just figure it out
 - You can copy all the files in the SocketRocket group into your app.
 - You can copy all the files in the SocketRocket group into your app.
 - Include SocketRocket as a subproject and use libSocketRocket
 - Include SocketRocket as a subproject and use libSocketRocket
 
 
-  If you do this, you must add ``-ObjC`` to your "other linker flags" option
+  If you do this, you must add -ObjC to your "other linker flags" option
 
 
 - For OS X you will have to repackage make a .framework target.  I will take
 - For OS X you will have to repackage make a .framework target.  I will take
   contributions. Message me if you are interested.
   contributions. Message me if you are interested.
@@ -173,6 +173,11 @@ In the same terminal session, start the chatroom server::
 
 
   python TestChatServer/py/chatroom.py
   python TestChatServer/py/chatroom.py
 
 
+There's also a Go implementation (with the latest weekly) where you can::
+
+  cd TestChatServer/go
+  go run chatroom.go
+
 Chatting
 Chatting
 ````````
 ````````
 Now, start TestChat.app (just run the target in the XCode project).  If you had
 Now, start TestChat.app (just run the target in the XCode project).  If you had
@@ -205,8 +210,7 @@ Autobahn/twisted.
 
 
 As far as Go's goes, it works in my limited testing. I much prefer go's
 As far as Go's goes, it works in my limited testing. I much prefer go's
 concurrency model as well. Try it! You may like it.
 concurrency model as well. Try it! You may like it.
-(``brew install --use-git --devel --HEAD go`` seems to give me a reasonable
-version).  It could use some more control over things such as pings, etc., but I
+It could use some more control over things such as pings, etc., but I
 am sure it will come in time.
 am sure it will come in time.
 
 
 Contributing
 Contributing

+ 2 - 0
TestChatServer/go/chatroom.go

@@ -49,6 +49,8 @@ func main() {
     msg := make(chan Msg)
     msg := make(chan Msg)
 
 
     http.Handle("/chat", websocket.Handler(newChatServer(reg, unreg, msg)))
     http.Handle("/chat", websocket.Handler(newChatServer(reg, unreg, msg)))
+    http.Handle("/", http.FileServer(http.Dir("../static")))
+
     go run(reg, unreg, msg)
     go run(reg, unreg, msg)
 
 
     err := http.ListenAndServe(":9000", nil)
     err := http.ListenAndServe(":9000", nil)

+ 1 - 1
TestChatServer/py/chatroom.py

@@ -19,7 +19,7 @@ args = None
 
 
 def parse_args():
 def parse_args():
     global args
     global args
-    static_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'static'))
+    static_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'static'))
     parser = argparse.ArgumentParser(description='Gateway server')
     parser = argparse.ArgumentParser(description='Gateway server')
 
 
     parser.add_argument('-v', '--verbose', help='verbose logging', action='store_true')
     parser.add_argument('-v', '--verbose', help='verbose logging', action='store_true')

+ 0 - 0
TestChatServer/py/static/.gitignore → TestChatServer/static/.gitignore


+ 0 - 0
TestChatServer/py/static/index.html → TestChatServer/static/index.html


+ 0 - 0
TestChatServer/py/static/proxy.js → TestChatServer/static/proxy.js