Strophe si-filetransfer in ionic-cordova

17 views
Skip to first unread message

Maurizio Poli

unread,
Mar 30, 2020, 1:07:10 PM3/30/20
to Strophe
hi,

I am developing an ionic-cordova application with chat via Openfire. I can’t get the si-filetransfer plugin to work

This are the npm packages:

"strophe.js": "^1.2.14",
"strophejs-plugin-http-file-upload": "^1.0.3",
"strophejs-plugins": "0.0.7",


and this the code in file .ts:

import { Strophe } from 'strophe.js';
  ........

  this.connection.si_filetransfer.addFileHandler(self.fileHandler);
  this.connection.ibb.addIBBHandler(self.ibbHandler);


but 'connection.si_filetransfer’ and ‘connection.ibb’ are always ‘undefined’

How can I import si_filetransfer and make it working?

Can anyone help me?

thanks in advance

Filipe Fernandes

unread,
Mar 30, 2020, 1:46:40 PM3/30/20
to str...@googlegroups.com
Hey, Im not sure, but probably you need to require the package so it injects its code to strophe, (not import) ex: top line of file put: require('strophejs-plugin-http-file-upload')

--
You received this message because you are subscribed to the Google Groups "Strophe" group.
To unsubscribe from this group and stop receiving emails from it, send an email to strophe+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/strophe/23d84214-4554-432f-bb8b-658a2f73a166%40googlegroups.com.

Maurizio Poli

unread,
Mar 31, 2020, 4:43:38 AM3/31/20
to Strophe
Hi,
thank's for you help

could you help me try the 'require' at the 'si_filetransfer', I tried:

require('strophe.si-filetransfer')


require('strophejs-plugins-si-filetransfer')


require('si-filetransfer')


I always get:

Cannot find module "..."




Il giorno lunedì 30 marzo 2020 19:46:40 UTC+2, Filipe Fernandes ha scritto:
Hey, Im not sure, but probably you need to require the package so it injects its code to strophe, (not import) ex: top line of file put: require('strophejs-plugin-http-file-upload')
On 25 Mar 2020, at 09:19, 'Maurizio Poli' via Strophe <str...@googlegroups.com> wrote:

hi,

I am developing an ionic-cordova application with chat via Openfire. I can’t get the si-filetransfer plugin to work

This are the npm packages:

"strophe.js": "^1.2.14",
"strophejs-plugin-http-file-upload": "^1.0.3",
"strophejs-plugins": "0.0.7",


and this the code in file .ts:

import { Strophe } from 'strophe.js';
  ........

  this.connection.si_filetransfer.addFileHandler(self.fileHandler);
  this.connection.ibb.addIBBHandler(self.ibbHandler);


but 'connection.si_filetransfer’ and ‘connection.ibb’ are always ‘undefined’

How can I import si_filetransfer and make it working?

Can anyone help me?

thanks in advance


--
You received this message because you are subscribed to the Google Groups "Strophe" group.
To unsubscribe from this group and stop receiving emails from it, send an email to str...@googlegroups.com.

Filipe Fernandes

unread,
Mar 31, 2020, 4:45:02 AM3/31/20
to str...@googlegroups.com
Should be the same name you have on package json

To unsubscribe from this group and stop receiving emails from it, send an email to strophe+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/strophe/b8837b25-7dd5-4939-8963-dae25f7596ad%40googlegroups.com.

Maurizio Poli

unread,
Mar 31, 2020, 4:59:12 AM3/31/20
to Strophe
this in my package json:

    "strophejs-plugins": "0.0.7",

this in my file .ts

require('strophejs-plugins');


but I still get:

Cannot find module"strophejs-plugin"


Filipe Fernandes

unread,
Mar 31, 2020, 5:05:44 AM3/31/20
to str...@googlegroups.com
try only
require('strophejs-plugin-http-file-upload');

To unsubscribe from this group and stop receiving emails from it, send an email to strophe+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/strophe/8df5a058-e5b4-492e-9581-12bdee15684c%40googlegroups.com.

Maurizio Poli

unread,
Mar 31, 2020, 5:12:47 AM3/31/20
to Strophe
strophejs-plugin-http-file-upload is included without errors but it is for another type of file transfer


https://github.com/strophe/strophejs-plugin-si-filetransfer/blob/master/readme.md
try only
require('strophejs-plugin-http-file-upload');

Filipe Fernandes

unread,
Mar 31, 2020, 5:14:55 AM3/31/20
to str...@googlegroups.com
Ah, then easy way is to download that 
strophe.si-filetransfer.js
 and require that file directly

To unsubscribe from this group and stop receiving emails from it, send an email to strophe+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/strophe/c34f654f-62e8-405c-859b-99ecf3892117%40googlegroups.com.

Maurizio Poli

unread,
Mar 31, 2020, 5:34:32 AM3/31/20
to Strophe
if I understand correctly you suggest me not to use the npm but to directly include the .js files

I already had this approach in the past and it didn't give me better results and this solution was not recommended for loading problems

but I can try again, it is possible that I made some mistakes

Filipe Fernandes

unread,
Mar 31, 2020, 5:39:54 AM3/31/20
to str...@googlegroups.com
I say this, because did not find that package on npm, as you see, those plugins were done years ago, they should still work, but are not up do date with best pratices :)
Afaik that package is not in npm, and the package "strophe-plugins" is just a readme file, there is no code there :)
Hope that solves it for you

To unsubscribe from this group and stop receiving emails from it, send an email to strophe+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/strophe/209454d6-f1f9-4a9c-9f0f-474528bc2679%40googlegroups.com.

Maurizio Poli

unread,
Mar 31, 2020, 6:05:11 AM3/31/20
to Strophe

Filipe Fernandes

unread,
Apr 3, 2020, 11:10:00 AM4/3/20
to str...@googlegroups.com
Usualy more than 2 years is old, but thing is, this works, all plugins seem to work, using a bunch of them, some 7 years old and they work fine

To unsubscribe from this group and stop receiving emails from it, send an email to strophe+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/strophe/f1b5bc3b-865b-4a8e-b4a9-b509030a1269%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages