Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-browser-output

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-browser-output - npm Package Compare versions

Comparing version 0.1.0 to 1.0.0

15

client.js

@@ -1,6 +0,13 @@

(function(){
(function grunt_browser_output(ssl){
if (typeof ssl === 'undefined'){
var scripts= document.getElementsByTagName('script');
var path= scripts[scripts.length-1].src;
var indexOfSsl = path.indexOf('ssl=');
ssl = (indexOfSsl === -1 ? false : path.substr(indexOfSsl + 4,4) === 'true');
}
var state = document.readyState;
if(state !== 'interactive' && state !== 'complete') {
setTimeout(arguments.callee, 100);
setTimeout(grunt_browser_output.bind(this,ssl), 100);
return;

@@ -14,3 +21,5 @@ }

var connection = new WebSocket('ws://localhost:37901');
var protocol = ssl ? 'wss' : 'ws';
var connection = new WebSocket(protocol + '://localhost:37901');
connection.onmessage = function(e){

@@ -17,0 +26,0 @@ var data = JSON.parse(e.data);

0

Gruntfile.js

@@ -0,0 +0,0 @@ /*

{
"name": "grunt-browser-output",
"version": "0.1.0",
"version": "1.0.0",
"description": "Redirect grunt output to the browser.",

@@ -5,0 +5,0 @@ "repository": {

@@ -35,3 +35,5 @@ # grunt-browser-output

browser_output: {
//no options currently, just need the empty target
options: { //all options are optional
port: 37901 //default is 37901
}
},

@@ -52,3 +54,24 @@ })

### HTTPS/SSL
If you run your site over HTTPS, you'll likely want to configure this task to also use HTTPS. Change the task config:
```js
grunt.initConfig({
browser_output: {
options: {
ssl: true,
key: grunt.file.read('path/to/server.key'),
cert: grunt.file.read('path/to/server.crt')
}
},
})
```
And in your index.html add put `?ssl=true` on the end of the client.js script tag:
```html
<script src="node_modules/grunt-browser-output/client.js?ssl=true"></script>
```
## Release History
- 3/13/2014 - v0.1.0 - Initial release.

@@ -10,6 +10,26 @@ 'use strict';

var options = this.options({port:37901});
//start server
var WebSocketServer = ws.Server;
var wss = new WebSocketServer({port: 37901});
var wss;
if (!options.ssl){
wss = new WebSocketServer({port: options.port});
} else {
var processRequest = function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Not implemented');
};
var app = require('https').createServer({
key: options.key,
cert: options.cert
},processRequest).listen(options.port);
wss = new WebSocketServer({server:app});
console.log('STARTED IN SSL MODE');
}
wss.broadcast = function(data) {

@@ -16,0 +36,0 @@ for(var i in this.clients) {

@@ -0,0 +0,0 @@ 'use strict';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc