Skip to content

Commit aa2e146

Browse files
Initial commit
0 parents  commit aa2e146

33 files changed

+3853
-0
lines changed

.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
*.py[cod]
2+
3+
# C extensions
4+
*.so
5+
6+
# Packages
7+
*.egg
8+
*.egg-info
9+
dist
10+
build
11+
eggs
12+
parts
13+
bin
14+
var
15+
sdist
16+
develop-eggs
17+
.installed.cfg
18+
lib
19+
lib64
20+
__pycache__
21+
22+
# Installer logs
23+
pip-log.txt
24+
25+
# Unit test / coverage reports
26+
.coverage
27+
.tox
28+
nosetests.xml
29+
30+
# Translations
31+
*.mo
32+
33+
# Mr Developer
34+
.mr.developer.cfg
35+
.project
36+
.pydevproject
37+
38+
docs/_build
39+
venv*
40+
.eggs
41+
.ropeproject
42+
.idea
43+
htmlcov
44+
*.swp

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Miguel Grinberg
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.rst

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
python-socketio
2+
===============
3+
4+
.. image:: https://travis-ci.org/miguelgrinberg/python-socketio.svg?branch=master
5+
:target: https://travis-ci.org/miguelgrinberg/python-socketio
6+
7+
Python implementation of the `Socket.IO`_ realtime server.
8+
9+
Features
10+
--------
11+
12+
- Fully compatible with the Javascript `socket.io-client`_ library.
13+
- Compatible with Python 2.7 and Python 3.3+.
14+
- Based on `Eventlet`_, enabling large number of clients even on modest
15+
hardware.
16+
- Includes a WSGI middleware that integrates Socket.IO traffic with
17+
standard WSGI applications.
18+
- Uses an event-based architecture implemented with decorators that
19+
hides the details of the protocol.
20+
- Implements HTTP long-polling and WebSocket transports.
21+
- Supports XHR2 and XHR browsers as clients.
22+
- Supports text and binary messages.
23+
- Supports gzip and deflate HTTP compression.
24+
- Configurable CORS responses to avoid cross-origin problems with
25+
browsers.
26+
27+
Example
28+
-------
29+
30+
The following application uses Flask to serve the HTML/Javascript to the
31+
client:
32+
33+
::
34+
35+
import socketio
36+
import eventlet
37+
from flask import Flask, render_template
38+
39+
sio = socketio.Server()
40+
app = Flask(__name__)
41+
42+
@app.route('/')
43+
def index():
44+
"""Serve the client-side application."""
45+
return render_template('index.html')
46+
47+
@sio.on('connect', namespace='/chat')
48+
def connect(sid, environ):
49+
print("connect ", sid)
50+
51+
@sio.on('chat message', namespace='/chat')
52+
def message(sid, data):
53+
print("message ", data)
54+
sio.emit(sid, 'reply')
55+
56+
@sio.on('disconnect', namespace='/chat')
57+
def disconnect(sid):
58+
print('disconnect ', sid)
59+
60+
if __name__ == '__main__':
61+
# wrap Flask application with engineio's middleware
62+
app = socketio.Middleware(eio, app)
63+
64+
# deploy as an eventlet WSGI server
65+
eventlet.wsgi.server(eventlet.listen(('', 8000)), app)
66+
67+
Resources
68+
---------
69+
70+
- `Documentation`_
71+
- `PyPI`_
72+
73+
.. _Socket.IO: https://github.com/Automattic/socket.io
74+
.. _socket.io-client: https://github.com/Automattic/socket.io-client
75+
.. _Eventlet: http://eventlet.net/
76+
.. _Documentation: http://pythonhosted.org/python-socketio
77+
.. _PyPI: https://pypi.python.org/pypi/python-socketio

docs/Makefile

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# Makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
PAPER =
8+
BUILDDIR = _build
9+
10+
# User-friendly check for sphinx-build
11+
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
13+
endif
14+
15+
# Internal variables.
16+
PAPEROPT_a4 = -D latex_paper_size=a4
17+
PAPEROPT_letter = -D latex_paper_size=letter
18+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
19+
# the i18n builder cannot share the environment and doctrees with the others
20+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
21+
22+
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
23+
24+
help:
25+
@echo "Please use \`make <target>' where <target> is one of"
26+
@echo " html to make standalone HTML files"
27+
@echo " dirhtml to make HTML files named index.html in directories"
28+
@echo " singlehtml to make a single large HTML file"
29+
@echo " pickle to make pickle files"
30+
@echo " json to make JSON files"
31+
@echo " htmlhelp to make HTML files and a HTML help project"
32+
@echo " qthelp to make HTML files and a qthelp project"
33+
@echo " applehelp to make an Apple Help Book"
34+
@echo " devhelp to make HTML files and a Devhelp project"
35+
@echo " epub to make an epub"
36+
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
37+
@echo " latexpdf to make LaTeX files and run them through pdflatex"
38+
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
39+
@echo " text to make text files"
40+
@echo " man to make manual pages"
41+
@echo " texinfo to make Texinfo files"
42+
@echo " info to make Texinfo files and run them through makeinfo"
43+
@echo " gettext to make PO message catalogs"
44+
@echo " changes to make an overview of all changed/added/deprecated items"
45+
@echo " xml to make Docutils-native XML files"
46+
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
47+
@echo " linkcheck to check all external links for integrity"
48+
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
49+
@echo " coverage to run coverage check of the documentation (if enabled)"
50+
51+
clean:
52+
rm -rf $(BUILDDIR)/*
53+
54+
html:
55+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
56+
@echo
57+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
58+
59+
dirhtml:
60+
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
61+
@echo
62+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
63+
64+
singlehtml:
65+
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
66+
@echo
67+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
68+
69+
pickle:
70+
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
71+
@echo
72+
@echo "Build finished; now you can process the pickle files."
73+
74+
json:
75+
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
76+
@echo
77+
@echo "Build finished; now you can process the JSON files."
78+
79+
htmlhelp:
80+
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
81+
@echo
82+
@echo "Build finished; now you can run HTML Help Workshop with the" \
83+
".hhp project file in $(BUILDDIR)/htmlhelp."
84+
85+
qthelp:
86+
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
87+
@echo
88+
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
89+
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
90+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/socketio.qhcp"
91+
@echo "To view the help file:"
92+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/socketio.qhc"
93+
94+
applehelp:
95+
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
96+
@echo
97+
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
98+
@echo "N.B. You won't be able to view it unless you put it in" \
99+
"~/Library/Documentation/Help or install it in your application" \
100+
"bundle."
101+
102+
devhelp:
103+
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
104+
@echo
105+
@echo "Build finished."
106+
@echo "To view the help file:"
107+
@echo "# mkdir -p $$HOME/.local/share/devhelp/socketio"
108+
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/socketio"
109+
@echo "# devhelp"
110+
111+
epub:
112+
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
113+
@echo
114+
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
115+
116+
latex:
117+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
118+
@echo
119+
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
120+
@echo "Run \`make' in that directory to run these through (pdf)latex" \
121+
"(use \`make latexpdf' here to do that automatically)."
122+
123+
latexpdf:
124+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
125+
@echo "Running LaTeX files through pdflatex..."
126+
$(MAKE) -C $(BUILDDIR)/latex all-pdf
127+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
128+
129+
latexpdfja:
130+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
131+
@echo "Running LaTeX files through platex and dvipdfmx..."
132+
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
133+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
134+
135+
text:
136+
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
137+
@echo
138+
@echo "Build finished. The text files are in $(BUILDDIR)/text."
139+
140+
man:
141+
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
142+
@echo
143+
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
144+
145+
texinfo:
146+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
147+
@echo
148+
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
149+
@echo "Run \`make' in that directory to run these through makeinfo" \
150+
"(use \`make info' here to do that automatically)."
151+
152+
info:
153+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
154+
@echo "Running Texinfo files through makeinfo..."
155+
make -C $(BUILDDIR)/texinfo info
156+
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
157+
158+
gettext:
159+
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
160+
@echo
161+
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
162+
163+
changes:
164+
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
165+
@echo
166+
@echo "The overview file is in $(BUILDDIR)/changes."
167+
168+
linkcheck:
169+
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
170+
@echo
171+
@echo "Link check complete; look for any errors in the above output " \
172+
"or in $(BUILDDIR)/linkcheck/output.txt."
173+
174+
doctest:
175+
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
176+
@echo "Testing of doctests in the sources finished, look at the " \
177+
"results in $(BUILDDIR)/doctest/output.txt."
178+
179+
coverage:
180+
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
181+
@echo "Testing of coverage in the sources finished, look at the " \
182+
"results in $(BUILDDIR)/coverage/python.txt."
183+
184+
xml:
185+
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
186+
@echo
187+
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
188+
189+
pseudoxml:
190+
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
191+
@echo
192+
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

docs/_static/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>python-socketio documentation</title>
5+
<meta http-equiv="refresh" content="0; URL=http://python-socketio.readthedocs.org/">
6+
<meta name="keywords" content="automatic redirection">
7+
</head>
8+
<body>
9+
The python-socketio documentation is available at <a href="http://python-socketio.readthedocs.org">Read the Docs</a>.
10+
If your browser does not automatically redirect you, please <a href="http://python-socketio.readthedocs.org">click here</a>.
11+
</body>
12+
</html>

docs/_static/logo.png

10.1 KB
Loading

docs/_themes/LICENSE

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Copyright (c) 2010 by Armin Ronacher.
2+
3+
Some rights reserved.
4+
5+
Redistribution and use in source and binary forms of the theme, with or
6+
without modification, are permitted provided that the following conditions
7+
are met:
8+
9+
* Redistributions of source code must retain the above copyright
10+
notice, this list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above
13+
copyright notice, this list of conditions and the following
14+
disclaimer in the documentation and/or other materials provided
15+
with the distribution.
16+
17+
* The names of the contributors may not be used to endorse or
18+
promote products derived from this software without specific
19+
prior written permission.
20+
21+
We kindly ask you to only use these themes in an unmodified manner just
22+
for Flask and Flask-related products, not for unrelated projects. If you
23+
like the visual style and want to use it for your own projects, please
24+
consider making some larger changes to the themes (such as changing
25+
font faces, sizes, colors or margins).
26+
27+
THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
31+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36+
ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE
37+
POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)