mirror of
https://github.com/mainflux/mainflux.git
synced 2025-04-29 13:49:28 +08:00

* Add basic websocket support Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add separate cards for base and regular attribs Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add arbitrary json metadata enc/dec Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add JsonMF module for JSON val handling Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Rename json related func for naming consistency Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Remove Thing type from user interface Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add arbitrary metadata json to channels Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Change json string identation Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
27 lines
833 B
HTML
27 lines
833 B
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Main</title>
|
|
<link rel="stylesheet" href="css/mainflux.css">
|
|
<script src="main.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="elm"></div>
|
|
<script>
|
|
var app = Elm.Main.init({
|
|
node: document.getElementById('elm')
|
|
});
|
|
var ws = new WebSocket("wss://echo.websocket.org");
|
|
// var ws = new WebSocket('wss://localhost/ws/channels/1dec73d1-2d74-456b-b1f3-0d4908e600cf/messages?authorization=9a6c7929-0213-40a9-9154-b8e43e01e103');
|
|
ws.onmessage = function(message)
|
|
{
|
|
console.log(message);
|
|
app.ports.websocketIn.send(JSON.stringify({data:message.data,timestamp:message.timeStamp}));
|
|
};
|
|
app.ports.websocketOut.subscribe(function(msg) { ws.send(msg); });
|
|
</script>
|
|
</body>
|
|
</html>
|