Page 1 of 1

Using Events & JWT

PostPosted: Wed Sep 13, 2017 4:05 am
by vmckillop
Hi Maxim,

Is there a way to add an event such as onDocumentStateChange after the DocsAPI.DocEditor is implemented instead of part of the config? As far as I can tell there is no way javascript function to the config as well as using the config to generate the JWT token as JWT doesn't have a concept of a javascript function.

Thanks,
Vaughan

Re: Using Events & JWT

PostPosted: Wed Sep 13, 2017 1:44 pm
by Maxim
Hello vmckillop!
Please specify what an event do you mean, what it is supposed to do, when would you call this event....any using scenario would be great.

Re: Using Events & JWT

PostPosted: Thu Sep 14, 2017 5:31 am
by vmckillop
Hi Maxim,

Any of the events available here: https://api.onlyoffice.com/editors/config/events normally configured in the config object such as

events: {
'onReady': onReady,
'onDocumentStateChange': onDocumentStateChange,
'onRequestEditRights': onRequestEditRights,
'onError': onError,
'onOutdatedVersion': onOutdatedVersion,
}

I am currently calling the CommandService.ashx asking for a force save of a file, however I always receive it to my callbackhandler at a minimum of 4.5 seconds later which is generally to slow for our customers. So I was thinking of using onDocumentStateChange, to call a force save each time a change is made to the document, therefore reducing the delay.

Thanks!

Re: Using Events & JWT

PostPosted: Thu Sep 14, 2017 6:48 am
by vmckillop
As a follow up to this. What is the reason why a user can 'download as' in the editor and the docx file will download within 600ms however calling forcesave through command service takes > 4.5seconds to receive file. Is there a way in the config files to change this?

Thanks,
Vaughan

Re: Using Events & JWT

PostPosted: Fri Sep 15, 2017 7:13 am
by vmckillop
Further followup to this, To speed things up I've temporarily turned off JWT for the editor, and am utilising the onDownloadAs event. This is responding back with a URL to the file in 250ms - exactly what we are hoping for! I just can't use it with JWT enabled. Still also confused why forcesave through API takes so much longer.

Any advice on where to go from here would be appreciated.