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
python-socketio

View File

@ -1,3 +1,8 @@
const io = require('socket.io-client');
// or with import syntax
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,43 +1,41 @@
<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="card">
<div class="item">
<div>
1
</div>
<div>
time
</div>
<div>
<i class="fas fa-check"></i>
</div>
<div class="card">
<div class="item">
<div>
1
</div>
<div>
time
</div>
<div>
<i class="fas fa-check"></i>
</div>
</div>
<div class="item"></div>
<div class="item">hoi</div>
<div class="item">hoi</div>
<div class="item">hoi</div>
<div class="item">hoi</div>
<div class="item">hoi</div>
</div>
<div class="card">
<div class="item">hoi</div>
</div>
<div class="card">
<div class="item">hoi</div>
</div>
<div class="item"></div>
<div class="item">hoi</div>
<div class="item">hoi</div>
<div class="item">hoi</div>
<div class="item">hoi</div>
<div class="item">hoi</div>
</div>
<div class="card">
<div class="item">hoi</div>
</div>
<div class="card">
<div class="item">hoi</div>
</div>
</div>
</body>
</body>
</html>