CodeIgniter Forums
How to implement EventSource on Codeignigter app? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10)
+--- Thread: How to implement EventSource on Codeignigter app? (/showthread.php?tid=75572)

Pages: 1 2 3 4


RE: How to implement EventSource on Codeignigter app? - SmokeyCharizard - 02-25-2020

(02-25-2020, 04:55 PM)dave friend Wrote:
(02-25-2020, 03:58 PM)SmokeyCharizard Wrote: Encase you can't see my message again, here's the pastebin. https://pastebin.com/eupHEA0c

I can see your PM.
I cannot send a reply to you.
Go the the edit options of your profile and check the box next to Receive private messages from other users.
Just did


RE: How to implement EventSource on Codeignigter app? - SmokeyCharizard - 02-26-2020

(02-25-2020, 04:55 PM)dave friend Wrote:
(02-25-2020, 03:58 PM)SmokeyCharizard Wrote: Encase you can't see my message again, here's the pastebin. https://pastebin.com/eupHEA0c

I can see your PM.
I cannot send a reply to you.
Go the the edit options of your profile and check the box next to Receive private messages from other users.
So after more experimentation, I found that the form data will POST to the controller via fetch if I remove the header, but the progress messages that echo during the process aren't fired until the process is done. The strange thing is that I even flush() inside the process, and the messages are sent as a response to my fetch request. 

I hardcoded the values I'm trying to pass, and I got the regular progress messages to eventsource throughout the process (instead of until it was done). Something about POSTing this data without a header prevents these messages from sending...


RE: How to implement EventSource on Codeignigter app? - dave friend - 02-26-2020

(02-26-2020, 03:57 PM)SmokeyCharizard Wrote: [So after more experimentation, I found that the form data will POST to the controller via fetch if I remove the header, but the progress messages that echo during the process aren't fired until the process is done. The strange thing is that I even flush() inside the process, and the messages are sent as a response to my fetch request. 

I hardcoded the values I'm trying to pass, and I got the regular progress messages to eventsource throughout the process (instead of until it was done). Something about POSTing this data without a header prevents these messages from sending...

The problem is that Fetch captures the progress messages. By its nature, the Fetch promise won't actually return anything until it is resolved. In short, EventSource is "flushing" the messages but Fetch is hoarding them.

The only thing this has to do with POST is that Fetch is the POSTer.

I've been experimenting and have not found an answer yet. I'm not sure there is one. There are responsibilities calling so I'm not sure when I'll have time to play with this again.