add some socket stuff

This commit is contained in:
Maxime Bloch 2019-09-20 17:16:45 +02:00
parent 4c282bc16b
commit 25f5a6417d
No known key found for this signature in database
GPG key ID: CE32A7D95B7D6418
3 changed files with 43 additions and 39 deletions

View file

@ -1 +1,2 @@
flask flask
python-socketio

View file

@ -1,3 +1,8 @@
const io = require('socket.io-client');
// or with import syntax
import io from 'socket.io-client'; import io from 'socket.io-client';
$(function() {
var socket = io();
socket.on('link_arrived', function(link_id) {
$('#current_run').append($('<div class="item>"</div>').text(link_id));
});
});

View file

@ -1,17 +1,14 @@
<html> <html>
<head>
<link href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" rel="stylesheet">
<script
type="text/javascript"
src="{{ url_for('static', filename = 'hello.js') }}"
></script>
<link
rel="stylesheet"
href="{{ url_for('static', filename = 'index.css') }}"
/>
</head>
<body> <head>
<link href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" rel="stylesheet">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js"></script>
<script src="https://code.jquery.com/jquery-1.11.1.js"></script>
<script type="text/javascript" src="{{ url_for('static', filename = 'index.js') }}"></script>
<link rel="stylesheet" href="{{ url_for('static', filename = 'index.css') }}" />
</head>
<body>
<div class="container"> <div class="container">
<div class="card"> <div class="card">
<div class="item"> <div class="item">
@ -39,5 +36,6 @@
<div class="item">hoi</div> <div class="item">hoi</div>
</div> </div>
</div> </div>
</body> </body>
</html> </html>