0

I'm just getting started with socketstream. I tried to create a hello world app:

var http = require('http'),
ss = require('socketstream');

ss.client.define('main', {
    view: 'app.html',
    css: ['libs'],
    code: ['app','libs'],
    tmpl: '*'});

ss.http.route('/',function(req, res) {
        res.serveClient('main');
    });

var server = http.Server(ss.http.middleware);
server.listen(3000);

ss.start(server);

It seems to load ok, but any of the libraries I put in client/code/libs doesn't seem to be pushed to the browser.

For example, I put underscore.js in client/code/libs with a very simple html file in client/views, and all I get is:

<html>
<head></head>
<body>
    bwahahahahahaha
</body>
</html>

Why is not loading/injecting the client libraries?

>

user1167650
  • 3,177
  • 11
  • 34
  • 46
  • Hi, could you show me the contents of the html file in client/views? I want to check that you have some code in the section of the html that loads the SocketStream files, because the output in the answer doesn't show that. – paulbjensen Dec 29 '12 at 11:53
  • 1
    To add more information, your client/views/app.html file's section should include a single self-closing tag called SocketStream, like this: – paulbjensen Dec 29 '12 at 11:59
  • oh, did not know that, didn't see that anywhere. That fixed the problem though, thanks! – user1167650 Dec 29 '12 at 18:08
  • Also make sure that you have no white space before the slash, so `` is good `` is bad - see the following for reference: https://github.com/socketstream/socketstream/blob/81638261eb86adff6dacd129ab03e07517bf4b31/lib/client/formatters/html.js#L20 – Jan Molak Apr 08 '14 at 14:33

1 Answers1

1

The issue here is to make sure that your html page's head section includes the < socketstream/ > tag.

paulbjensen
  • 828
  • 7
  • 6