Using Websockets in codeigniter? |
Hey guys, it's me again.
I still have the notification issue, but I asked my professors, and they said the best solution is indeed Websockets. I found a great library for websockets in codeigniter here, and it does work, but I can't seem to figure out how to send messages from the modal to a view. I did the simple setup with the "php vendor/takielias/codeigniter-websocket/install.php --app_path=application" command, and I was able to have to 'clients' talk to one another. I was even about to get one of them to talk to my view php file. Now I just need to get the modal to talk to the view. I tried adding this to the top of the modal file: Code: defined('BASEPATH') OR exit('No direct script access allowed'); And then I try to log in in the modal's constructor with this: Code: $this->client = new Client('ws://0.0.0.0:8282'); The readme states that the first message is necessary for validation of the connection. Despite this, I never receive the message on the view file. The socket code in my view is: Code: var conn = new WebSocket('ws://localhost:8282'); Let me guess, its the ports? I played around with them to no avail. Any ideas?
(02-28-2020, 07:28 PM)SmokeyCharizard Wrote: Hey guys, it's me again.Turns out, you can send the messages from the CONTROLLER, but not the model! I made the apropriot changes to my code, and it works! Just one problem, though... It isn't working on my AWS instance. Is there some reason why? Permissions, maybe? |
Welcome Guest, Not a member yet? Register Sign In |