11** SSL/TLS not supported** (use secure WebSockets instead)
22
3- ``` eventedapi.js ``` prologue
4- ----------------------------
5- ``` javascript
6- require (' ./pg/lib/generic-pool.js' );
7- require (' ./pg/lib/writer.js' );
8- require (' ./pg/lib/utils.js' );
9- require (' ./pg/lib/binaryParsers.js' );
10- require (' ./pg/lib/arrayParser.js' );
11- require (' ./pg/lib/textParsers.js' );
12- require (' ./pg/lib/types.js' );
13- require (' ./pg/lib/result.js' );
14- require (' ./pg/lib/query.js' );
15- require (' ./pg/lib/client.js' );
16- require (' ./pg/lib/defaults.js' );
17- require (' ./pg/lib/connection.js' );
18- var pg = require (' ./pg/lib/index.js' );
19-
20- // conString must be object! URL's not supported (they are in the dns module, not available in the browser)
21- var conString = {" host" : " localhost" , " port" : 5432 , " password" : " test" , " user" : " janus" , " database" : " janus" };
22- var client = new pg.Client (conString);
23- // ...
24- ```
25-
263Setting up postgres:
274
285``` bash
@@ -46,6 +23,14 @@ $ ~/websockify/websockify 5432 -- /usr/lib/postgresql/9.1/bin/postgres -D .
4623 <script src =" /websockify/include/util.js" ></script >
4724 <script src =" /websockify/include/websock.js" ></script >
4825 <script src =" bundle.js" ></script >
26+ <script >
27+ var pg = require (' pg' );
28+
29+ // conString must be object! URL's not supported (they are in the dns module, not available in the browser)
30+ var conString = {" host" : " localhost" , " port" : 5432 , " password" : " test" , " user" : " janus" , " database" : " janus" };
31+ var client = new pg.Client (conString);
32+ // ...
33+ </script >
4934 </head >
5035 <body >
5136 <!-- Check the console when running! -->
@@ -56,7 +41,7 @@ $ ~/websockify/websockify 5432 -- /usr/lib/postgresql/9.1/bin/postgres -D .
5641Building
5742--------
5843```
59- browserify -a ' dns:net' -e eventedapi .js -o bundle.js
44+ browserify -a dns:net -r generic-pool -r $PWD/pg/lib/index .js:pg $(for i in $PWD/pg/lib/*.js; do echo -n "-r $i "; done) -o bundle.js
6045```
6146
62- Now open ``` bundle.html ``` over HTTP (make sure XHR permits WebSocket connections from that server to the WebSocket server!)
47+ Now open ``` bundle.html ``` over HTTP (make sure XHR permits WebSocket connections from that server to the WebSocket server!)
0 commit comments