mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
Add socketio javascript
This commit is contained in:
parent
a44407255b
commit
9f215d7613
@ -1,12 +1,10 @@
|
||||
from flask import (abort, current_app, flash, redirect, request,
|
||||
render_template, url_for, send_from_directory)
|
||||
from flask_login import current_user, login_required
|
||||
from ..models import Corpus, User
|
||||
from ..tables import AdminUserTable, AdminUserItem
|
||||
from . import main
|
||||
from .forms import CreateCorpusForm
|
||||
from ..decorators import admin_required
|
||||
from .. import db
|
||||
from .. import db, socketio
|
||||
from ..models import Corpus
|
||||
import os
|
||||
|
||||
|
||||
@ -15,6 +13,12 @@ def index():
|
||||
return render_template('main/index.html.j2', title='Opaque')
|
||||
|
||||
|
||||
@socketio.on('my event')
|
||||
@login_required
|
||||
def handle_message(message):
|
||||
print('received message: ' + str(message))
|
||||
|
||||
|
||||
@main.route('/corpora/<int:corpus_id>')
|
||||
@login_required
|
||||
def corpus(corpus_id):
|
||||
|
9
app/static/js/socket.io.js
Normal file
9
app/static/js/socket.io.js
Normal file
File diff suppressed because one or more lines are too long
@ -27,6 +27,13 @@
|
||||
<script src="{{ url_for('static', filename='js/jsondiffpatch.umd.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/polls.js') }}"></script>
|
||||
{% endif %}
|
||||
<script src="{{ url_for('static', filename='js/socket.io.js') }}"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var socket = io();
|
||||
socket.on('connect', function() {
|
||||
socket.emit('my event', {data: 'I\'m connected!'});
|
||||
});
|
||||
</script>
|
||||
<script src="{{ url_for('static', filename='js/list.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/utils.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/CorpusList.js') }}"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user