You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This specification defines an XMPP protocol extension that enables any two entities to establish a one-to-one bytestream between themselves, where the data is broken down into smaller chunks and transported in-band over XMPP.
Usage
Include the stream initiation and ibb plugins in the head.
Add handlers to listen for stream initiations and files, or use the api to send files of your own.
varconnection=newStrophe.Connection();varfileHandler=function(from,sid,filename,size,mime){// received a stream initiation// save to data and be prepared to receive the file.};connection.si_filetransfer.addFileHandler(fileHandler);varibbHandler=function(type,from,sid,data,seq){switch(type){case"open":
// new file, only metadatabreak;case"data":
// databreak;case"close":
// and we're donedefault:
thrownewError("shouldn't be here.")}};connection.ibb.addIBBHandler(ibbHandler);// send a stream initiationconnection.si_filetransfer.send(to,sid,filename,filesize,mime,function(err){if(err){returnconsole.log(err);}// successfully initiated the transfer, now open the bandconnection.ibb.open(to,sid,chunksize,function(err){if(err){returnconsole.log(err);}// stream is open, start sending chunks of dataconnection.ibb.data(to,sid,seq,msg,function(err){if(err){returnconsole.log(err);}// ... repeat calling data// keep sending until you're ready you've reached the end of the fileconnection.ibb.close(to,sid,function(err){if(err){returnconsole.log(err);}// done});});});});