Comments (5)
Could you give me your code?
from socket.io-stream.
There are 2 files attached to this message.
- upload.html
- ioserver.js
[ upload.html ]
START
<script type="text/javascript"
src="/socket.io/socket.io.js"></script>
<script type="text/javascript"
src="/js/socket.io-stream.js"></script>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>
$(function() {
$('#file').change(function(e) {
var file = e.target.files[0];
var stream = ss.createStream();
// upload a file to the server.
ss(socket).emit('file', stream, {size: file.size});
ss.createBlobReadStream(file).pipe(stream);
});
});
var socket = io.connect('http://localhost:8080');
socket.on('connect', function(){
console.log('socket ready!');
});
</script>
END
[ ioserver.js ]
START
var fs = require('fs');
var path = require('path');
var ss = require('socket.io-stream');
var startIOListener = function() {
var app = require('http').createServer(function (req, res) {
fs.readFile(__dirname + '/public/upload.html',
function (err, data) {
if (err) {
res.writeHead(500);
return res.end('Error loading index.html');
}
res.writeHead(200);
res.end(data);
});
})
, io = require('socket.io').listen(app)
, fs = require('fs')
app.listen(8080);
io.sockets.on('connection', function (socket) {
ss(socket).on('profile-image', function(stream, data) {
var filename = path.basename(data.name);
stream.pipe(fs.createWriteStream(filename));
});
});
}
startIOListener();
END
The error seems to be in upload.html, but I'm kinda stuck on why.
Thanks in advance.
Mark
------ Original Message ------
From: "nkzawa" [email protected]
To: "nkzawa/socket.io-stream" [email protected]
Cc: "maeuca" [email protected]
Sent: 10/8/2013 12:25:49 PM
Subject: Re: [socket.io-stream] Browser socket.io-stream (#14)
Could you give me your code?
—
Reply to this email directly or view it on GitHub.
from socket.io-stream.
Sorry for the late reply.
Did you expose the file to a public directory like the following?
$ cp node_modules/socket.io-stream/socket.io-stream.js somewhere/public/
See: https://github.com/nkzawa/socket.io-stream#browser
from socket.io-stream.
my web server was not configured properly.
working fine now, thanks!
--- Original Message ---
From: "nkzawa" [email protected]
Sent: October 10, 2013 11:58 AM
To: "nkzawa/socket.io-stream" [email protected]
Cc: "maeuca" [email protected]
Subject: Re: [socket.io-stream] Browser socket.io-stream (#14)
Sorry for the late reply.
Did you expose the file to a public directory like the following?
$ cp node_modules/socket.io-stream/socket.io-stream.js somewhere/public/
See: https://github.com/nkzawa/socket.io-stream#browser
Reply to this email directly or view it on GitHub:
#14 (comment)
from socket.io-stream.
it showing browserify:command not found when i'm run this command in terminal browserify index.js -s ss > socket.io-stream.js
from socket.io-stream.
Related Issues (20)
- server > client HOT 1
- Simpler API
- MediaStream HOT 11
- Can you upload a folder?
- events.js:62 Uncaught Error: Uncaught, unspecified "error" event. (Authentication error) HOT 1
- Able to send/receive a native browser stream HOT 1
- An error when using Socket.io-stream with Electron.
- A port to other languages
- Stream interrupted file
- Uncaught TypeError: Cannot read property '_read' of null HOT 3
- Server dont recive emit or client dont emit HOT 3
- Send audio file from node.js server to another node.js server
- Client iOS
- This version of debug is vulnerable to ReDos attacks HOT 3
- In browser console getting error
- [Deprecation] SharedArrayBuffer
- add a settimeout to it to reduce cpu consumption
- Unfortunately there is no support for rooms and broadcasting for now.
- Could not create stream object. Getting Cannot read properties of undefined error.
- donot work with ubuntu 22.04
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from socket.io-stream.