Skip to content

Commit

Permalink
README.md: Add syntax highlighting to python code (#723)
Browse files Browse the repository at this point in the history
  • Loading branch information
meetmangukiya authored and miguelgrinberg committed Jun 19, 2018
1 parent cec3986 commit cc49b24
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,25 @@ You can install this package as usual with pip:
Example
-------

from flask import Flask, render_template
from flask_socketio import SocketIO, emit
```py
from flask import Flask, render_template
from flask_socketio import SocketIO, emit

app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)

@app.route('/')
def index():
return render_template('index.html')

@socketio.on('my event')
def test_message(message):
emit('my response', {'data': 'got it!'})

if __name__ == '__main__':
socketio.run(app)
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)

@app.route('/')
def index():
return render_template('index.html')

@socketio.on('my event')
def test_message(message):
emit('my response', {'data': 'got it!'})

if __name__ == '__main__':
socketio.run(app)
```

Resources
---------
Expand Down

0 comments on commit cc49b24

Please sign in to comment.