catalinux / Conn (public) (License: LGPLv2) (since 2016-03-01) (hash sha1)
Net library for easy building ipv4/ipv6 network daemons/clients
List of commits:
Subject Hash Author Date (UTC)
CSS fixes for showing source 1b96ffce7e3744972be0be246cd33d0b107a8553 Catalin(ux) M. BOIE 2018-08-17 03:42:45
Bump version to 1.0.39 9b34e52482191606aa7f92a781d5b5e33a5543c8 Catalin(ux) M. BOIE 2018-05-20 19:14:39
CSS fixes for wsdemo 7fed15a4b4a7ebc154f68a99eb413fea4726ec26 Catalin(ux) M. BOIE 2018-05-20 19:13:44
More compiler flags for security d33f9fdb57826353c755b86493c72993635b1053 Catalin(ux) M. BOIE 2018-05-20 18:56:42
grid1 is working now 0370e6808f8b89fb9ae43fc139195e76247ad6c5 Catalin(ux) M. BOIE 2018-05-12 15:31:00
Added pie2 demo (svg) e8df18b15deafdd0a810a09a251593ecd5fc608f Catalin(ux) M. BOIE 2018-04-17 21:46:02
wsdemo: added Source button 010d08897f99736b9a3f5440af71c2dc40544e68 Catalin(ux) M. BOIE 2018-04-17 17:54:53
More tweaks to wsdemo 56173807662daf36b36907d98bde751749c91075 Catalin(ux) M. BOIE 2018-04-16 18:08:18
Added a callback for worker start 32a05f401d5258f06af9db15a00a615859961cc2 Catalin(ux) M. BOIE 2018-04-16 18:07:55
wsdemo improvements 3eb3efd007fc9240ea39fabcdb4729d1367ebad2 Catalin(ux) M. BOIE 2018-04-13 22:47:24
wsdemo added 2baae01f2409496f990b6d673013b66286f0a5af Catalin(ux) M. BOIE 2018-04-02 21:41:40
Various small stuff 0c551268be734dd68a59426315abfc6ef776c60a Catalin(ux) M. BOIE 2018-04-02 21:40:49
More debugging for websocket parsing 66ccde632b280f1aa450610e6b671464b7e56451 Catalin(ux) M. BOIE 2018-04-02 21:39:23
Raise to 4096 to buffer for logging a59dee1fdfe087ff13e4c7012fe29f8da99ad75c Catalin(ux) M. BOIE 2018-04-02 21:38:11
Bump version 9b635cebfffdd6971eefef0ebad395e21684bb8a Catalin(ux) M. BOIE 2018-01-13 18:07:12
Added some more compile flags and websocket1 helper files. fce47295946106956fb70da77244d77ffca09423 Catalin(ux) M. BOIE 2018-01-13 18:03:46
Lots of changes everywhere 91b9113e8f92db07c079c005273683f2e868910c Catalin(ux) M. BOIE 2018-01-12 19:06:04
Require openssl (for websocket) b4b34eb88f38bfd421187da76611cc54476d7309 Catalin(ux) M. BOIE 2017-12-30 23:44:50
Very important fixes 01e33f06a5cdc52fb3795158fd838fcca7055dda Catalin(ux) M. BOIE 2017-12-30 23:39:17
Bump version to 1.0.37 54e8f3bcaf7f7e096c454563039a545a4abb1bf0 Catalin(ux) M. BOIE 2017-12-30 22:13:12
Commit 1b96ffce7e3744972be0be246cd33d0b107a8553 - CSS fixes for showing source
Author: Catalin(ux) M. BOIE
Author date (UTC): 2018-08-17 03:42
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2018-08-17 03:42
Parent(s): 9b34e52482191606aa7f92a781d5b5e33a5543c8
Signing key:
Tree: 3278b58e6834508be65958c1ce41af372b62f9ba
File Lines added Lines deleted
Conn_web.c 0 1
examples/wsdemo.c 30 18
examples/wsdemo.data/index.html 3 2
examples/wsdemo.data/main.css 7 0
File Conn_web.c changed (mode: 100644) (index 2d369bf..71f6810)
... ... int Conn_web_create(struct Conn *C)
63 63 Conn_web_free(C->web); Conn_web_free(C->web);
64 64
65 65 C->web = web; C->web = web;
66 Log(10, "\tattached!\n");
67 66
68 67 return 0; return 0;
69 68 } }
File examples/wsdemo.c changed (mode: 100644) (index cd18486..564d9bd)
... ... static void trigger(struct Conn *C)
888 888 " };\n" " };\n"
889 889 " ws.send(JSON.stringify(data));\n" " ws.send(JSON.stringify(data));\n"
890 890 "}\n" "}\n"
891 "window.addEventListener('resize', window.wsdemo.my_resize, true);\n"
892 "window.wsdemo.my_resize();\n"
891 893 "\n" "\n"
892 "window.wsdemo.source = function(name) {\n"
894 "window.wsdemo.source = function(name, functions) {\n"
893 895 " var t;\n" " var t;\n"
894 896 " var d = document.getElementById(name + '_source');\n" " var d = document.getElementById(name + '_source');\n"
895 " if (d.innerHTML == '' || d.innerHTML == '<pre></pre>')\n"
896 " t = window.wsdemo[name + '_update'].toString();\n"
897 " else\n"
897 " if (d.innerHTML == '') {\n"
898 " add = '';\n"
898 899 " t = '';\n" " t = '';\n"
899 " d.innerHTML = '<pre>' + t + '</pre>';\n"
900 "}\n"
901 "window.addEventListener('resize', window.wsdemo.my_resize, true);\n"
902 "window.wsdemo.my_resize();\n";
900 " for (i = 0; i < functions.length; i++) {\n"
901 " t = t + add + 'Function <b>' + functions[i] + '</b>:'\n"
902 " + '<pre>' + window.wsdemo[functions[i]].toString() + '</pre>';\n"
903 " add = '<br />';\n"
904 " }\n"
905 " d.innerHTML = t;\n"
906 " }\n"
907 "\n"
908 " // Toggle visibility\n"
909 " console.log('display=' + d.style.display);\n"
910 " if (d.style.display == 'block')\n"
911 " d.style.display = 'none';\n"
912 " else\n"
913 " d.style.display = 'block';\n"
914 "}\n";
903 915 push_code(C, code); push_code(C, code);
904 916
905 917 p->per1_percent = random() % 50; p->per1_percent = random() % 50;
 
... ... static const char main_screen[] =
932 944 "<div style=\"margin: 3px; height: 10px; width: 100px; background-color: #eeeeee; border: 1px solid\">\n" "<div style=\"margin: 3px; height: 10px; width: 100px; background-color: #eeeeee; border: 1px solid\">\n"
933 945 " <div id=\"per1\" style=\"height: 10px; width: 0px; background-color: red\"></div>\n" " <div id=\"per1\" style=\"height: 10px; width: 0px; background-color: red\"></div>\n"
934 946 "</div>\n" "</div>\n"
935 "<input type=\"button\" onclick=\"window.wsdemo.source('per1');\" value=\"Source\" />\n"
947 "<input type=\"button\" onclick=\"window.wsdemo.source('per1', ['per1_update']);\" value=\"Source\" />\n"
936 948 "<div class=\"source\" id=\"per1_source\"></div>\n" "<div class=\"source\" id=\"per1_source\"></div>\n"
937 949 "</div>\n" "</div>\n"
938 950 "\n" "\n"
 
... ... static const char main_screen[] =
949 961 " <rect id=\"per2\" x=\"5\" y=\"5\" width=\"0\" height=\"10\" fill=\"url(#per2_gra1)\" />\n" " <rect id=\"per2\" x=\"5\" y=\"5\" width=\"0\" height=\"10\" fill=\"url(#per2_gra1)\" />\n"
950 962 " <rect x=\"5\" y=\"5\" width=\"100\" height=\"10\" style=\"fill:transparent; stroke-width:.1; stroke:black\" />\n" " <rect x=\"5\" y=\"5\" width=\"100\" height=\"10\" style=\"fill:transparent; stroke-width:.1; stroke:black\" />\n"
951 963 "</svg><br />\n" "</svg><br />\n"
952 "<input type=\"button\" onclick=\"window.wsdemo.source('per2');\" value=\"Source\" />\n"
964 "<input type=\"button\" onclick=\"window.wsdemo.source('per2', ['per2_update']);\" value=\"Source\" />\n"
953 965 "<div class=\"source\" id=\"per2_source\"></div>\n" "<div class=\"source\" id=\"per2_source\"></div>\n"
954 966 "</div>\n" "</div>\n"
955 967 "\n" "\n"
 
... ... static const char main_screen[] =
959 971 " <g id=\"load1\"></g>\n" " <g id=\"load1\"></g>\n"
960 972 " <text id=\"load1_text\" x=\"2\" y=\"99\" style=\"font-size: 10px\">Load here</text>\n" " <text id=\"load1_text\" x=\"2\" y=\"99\" style=\"font-size: 10px\">Load here</text>\n"
961 973 "</svg><br />\n" "</svg><br />\n"
962 "<input type=\"button\" onclick=\"window.wsdemo.source('load1');\" value=\"Source\" />\n"
974 "<input type=\"button\" onclick=\"window.wsdemo.source('load1', ['load1_update']);\" value=\"Source\" />\n"
963 975 "<div class=\"source\" id=\"load1_source\"></div>\n" "<div class=\"source\" id=\"load1_source\"></div>\n"
964 976 "<div class=\"note\" width=\"100px\">Note: the width of the SVG is scaled based on" "<div class=\"note\" width=\"100px\">Note: the width of the SVG is scaled based on"
965 977 " available width, but no more than 100px; previous values are pushed by the server.</div>\n" " available width, but no more than 100px; previous values are pushed by the server.</div>\n"
 
... ... static const char main_screen[] =
973 985 " <text id=\"band1_text_up\" x=\"1\" y=\"7\" style=\"font-size: 5pt\"></text>\n" " <text id=\"band1_text_up\" x=\"1\" y=\"7\" style=\"font-size: 5pt\"></text>\n"
974 986 " <text id=\"band1_text_down\" x=\"1\" y=\"100\" style=\"font-size: 5pt\"></text>\n" " <text id=\"band1_text_down\" x=\"1\" y=\"100\" style=\"font-size: 5pt\"></text>\n"
975 987 "</svg><br />\n" "</svg><br />\n"
976 "<input type=\"button\" onclick=\"window.wsdemo.source('band1');\" value=\"Source\" />\n"
988 "<input type=\"button\" onclick=\"window.wsdemo.source('band1', ['band1_update']);\" value=\"Source\" />\n"
977 989 "<div class=\"source\" id=\"band1_source\"></div>\n" "<div class=\"source\" id=\"band1_source\"></div>\n"
978 990 "<div class=\"note\" width=\"200px\">Note: the width of the SVG is" "<div class=\"note\" width=\"200px\">Note: the width of the SVG is"
979 991 " scaled based on available width, but no more than 200px.</div>\n" " scaled based on available width, but no more than 200px.</div>\n"
 
... ... static const char main_screen[] =
1004 1016 " <text x=\"30\" y=\"72\" fill=\"#990\"></text>\n" " <text x=\"30\" y=\"72\" fill=\"#990\"></text>\n"
1005 1017 " </g>\n" " </g>\n"
1006 1018 "</svg><br />\n" "</svg><br />\n"
1007 "<input type=\"button\" onclick=\"window.wsdemo.source('arc1');\" value=\"Source\" />\n"
1019 "<input type=\"button\" onclick=\"window.wsdemo.source('arc1', ['arc1_update']);\" value=\"Source\" />\n"
1008 1020 "<div class=\"source\" id=\"arc1_source\"></div>\n" "<div class=\"source\" id=\"arc1_source\"></div>\n"
1009 1021 "</div>\n" "</div>\n"
1010 1022 "\n" "\n"
 
... ... static const char main_screen[] =
1016 1028 " <g id=\"bar1_text\"></g>\n" " <g id=\"bar1_text\"></g>\n"
1017 1029 " <g id=\"bar1_values\"></g>\n" " <g id=\"bar1_values\"></g>\n"
1018 1030 "</svg><br />\n" "</svg><br />\n"
1019 "<input type=\"button\" onclick=\"window.wsdemo.source('bar1');\" value=\"Source\" />\n"
1031 "<input type=\"button\" onclick=\"window.wsdemo.source('bar1', ['bar1_update']);\" value=\"Source\" />\n"
1020 1032 "<div class=\"source\" id=\"bar1_source\"></div>\n" "<div class=\"source\" id=\"bar1_source\"></div>\n"
1021 1033 "</div>\n" "</div>\n"
1022 1034 "\n" "\n"
 
... ... static const char main_screen[] =
1025 1037 "<canvas id=\"cyl1\" width=\"100px\" height=\"100px\">\n" "<canvas id=\"cyl1\" width=\"100px\" height=\"100px\">\n"
1026 1038 " Your browser does not support canvas.\n" " Your browser does not support canvas.\n"
1027 1039 "</canvas><br />\n" "</canvas><br />\n"
1028 "<input type=\"button\" onclick=\"window.wsdemo.source('cyl1');\" value=\"Source\" />\n"
1040 "<input type=\"button\" onclick=\"window.wsdemo.source('cyl1', ['cyl1_update']);\" value=\"Source\" />\n"
1029 1041 "<div class=\"source\" id=\"cyl1_source\"></div>\n" "<div class=\"source\" id=\"cyl1_source\"></div>\n"
1030 1042 "</div>\n" "</div>\n"
1031 1043 "\n" "\n"
 
... ... static const char main_screen[] =
1034 1046 "<canvas id=\"pie1\" width=\"200px\" height=\"100px\">\n" "<canvas id=\"pie1\" width=\"200px\" height=\"100px\">\n"
1035 1047 " Your browser does not support canvas.\n" " Your browser does not support canvas.\n"
1036 1048 "</canvas><br />\n" "</canvas><br />\n"
1037 "<input type=\"button\" onclick=\"window.wsdemo.source('pie1');\" value=\"Source\" />\n"
1049 "<input type=\"button\" onclick=\"window.wsdemo.source('pie1', ['pie1_update']);\" value=\"Source\" />\n"
1038 1050 "<div class=\"source\" id=\"pie1_source\"></div>\n" "<div class=\"source\" id=\"pie1_source\"></div>\n"
1039 1051 "</div>\n" "</div>\n"
1040 1052 "\n" "\n"
 
... ... static const char main_screen[] =
1051 1063 " <g id=\"pie2\" filter=\"url(#pie2_ds1)\"></g>\n" " <g id=\"pie2\" filter=\"url(#pie2_ds1)\"></g>\n"
1052 1064 " <g id=\"pie2_text\"></g>\n" " <g id=\"pie2_text\"></g>\n"
1053 1065 "</svg><br />\n" "</svg><br />\n"
1054 "<input type=\"button\" onclick=\"window.wsdemo.source('pie2');\" value=\"Source\" />\n"
1066 "<input type=\"button\" onclick=\"window.wsdemo.source('pie2', ['pie2_update']);\" value=\"Source\" />\n"
1055 1067 "<div class=\"source\" id=\"pie2_source\"></div>\n" "<div class=\"source\" id=\"pie2_source\"></div>\n"
1056 1068 "</div>\n" "</div>\n"
1057 1069 "\n" "\n"
1058 1070 "<div class=\"gem\">\n" "<div class=\"gem\">\n"
1059 1071 " Editable grid (HTML5 content editable)<br />\n" " Editable grid (HTML5 content editable)<br />\n"
1060 1072 " <div id=\"grid1\"></div>\n" " <div id=\"grid1\"></div>\n"
1061 " <input type=\"button\" onclick=\"window.wsdemo.source('grid1');\" value=\"Source\" />\n"
1073 " <input type=\"button\" onclick=\"window.wsdemo.source('grid1', ['grid1_update', 'grid1_oninput', 'grid1_init']);\" value=\"Source\" />\n"
1062 1074 " <div class=\"source\" id=\"grid1_source\"></div>\n" " <div class=\"source\" id=\"grid1_source\"></div>\n"
1063 1075 " <div class=\"note\" width=\"200px\">" " <div class=\"note\" width=\"200px\">"
1064 1076 " Note: please load this page on two different devices, then try" " Note: please load this page on two different devices, then try"
File examples/wsdemo.data/index.html changed (mode: 100644) (index 5a43c1c..22f083e)
19 19 --> -->
20 20
21 21 <div id="welcome"> <div id="welcome">
22 Welcome to <a href="https://rocketgit.com/user/catalinux/Conn" target="_blank">Conn</a> wsdemo!<br />
22 Welcome to <a href="https://rocketgit.com/user/catalinux/Conn/source/tree/branch/master/blob/examples/wsdemo.c" target="_blank">wsdemo!</a><br />
23 It is using <a href="https://rocketgit.com/user/catalinux/Conn" target="_blank">Conn</a> library for the web part.<br />
23 24 Author: Catalin(ux) M. BOIE<br /> Author: Catalin(ux) M. BOIE<br />
24 25 This demo tries to prove that you can build websites without insane (more than 100KiB) This demo tries to prove that you can build websites without insane (more than 100KiB)
25 26 amount of JavaScript code. I am very disappointed by today websites. Disgusting crap. amount of JavaScript code. I am very disappointed by today websites. Disgusting crap.
26 27 The sad thing is that this crap becomes standard.<br /> The sad thing is that this crap becomes standard.<br />
27 28 The server side is a C application dealing with the data push.<br /> The server side is a C application dealing with the data push.<br />
28 29 On the client side, there is the JS code dealing with websocket and a very small part On the client side, there is the JS code dealing with websocket and a very small part
29 to dispatch the data pushed. The whole JS code is less than 5KiB.<br />
30 to dispatch the data pushed. The whole JS code used here is around than 5KiB.<br />
30 31 Enjoy the demo and do not forget to send feedback to wsdemo@embedromix.ro!<br /> Enjoy the demo and do not forget to send feedback to wsdemo@embedromix.ro!<br />
31 32 </div> </div>
32 33
File examples/wsdemo.data/main.css changed (mode: 100644) (index 72167d9..d2ca30b)
... ... body {
6 6 margin: 0; margin: 0;
7 7 } }
8 8
9 pre {
10 margin: 0;
11 }
12
9 13 #welcome { #welcome {
10 14 border: 1px solid black; border: 1px solid black;
11 15 padding: 3px; padding: 3px;
 
... ... body {
52 56 .source { .source {
53 57 font-size: 7pt; font-size: 7pt;
54 58 border: 1px solid red; border: 1px solid red;
59 padding: 3px;
60 margin: 1px;
61 display: none;
55 62 } }
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/catalinux/Conn

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/catalinux/Conn

Clone this repository using git:
git clone git://git.rocketgit.com/user/catalinux/Conn

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main