Coder Social home page Coder Social logo

Comments (22)

d33pak-s1ngh avatar d33pak-s1ngh commented on June 27, 2024

i want to create a socket through which i can listen notification on android device whenever admin issues any notification.
i am using codeigniter for server side coding with mysql.

from codeigniter-ratchet-websocket.

kishor10d avatar kishor10d commented on June 27, 2024

@d33pak-s1ngh : Actually you need to provide your real-ip-address, which is generated by your lan network. e.g. 192.168.0.234

Please check with command "ifconfig" and replace ip-address with that one. It will work.

from codeigniter-ratchet-websocket.

d33pak-s1ngh avatar d33pak-s1ngh commented on June 27, 2024

from codeigniter-ratchet-websocket.

kishor10d avatar kishor10d commented on June 27, 2024

@d33pak-s1ngh : please upload the screenshot. We will look into it together.

from codeigniter-ratchet-websocket.

d33pak-s1ngh avatar d33pak-s1ngh commented on June 27, 2024

ok i tried in windows 7 without changing value of BROADCAST_URL it is on its default 192.168.0.6 and i enter a value in textbox and value is getting stored in to database without any page refresh so this what websocket do??

this can be done with ajax also

what i want to do is that whenever any record insert into database i should get notifcation in android app that record has been inserted. can we do that with this websocket plugin which you have provided.

from codeigniter-ratchet-websocket.

d33pak-s1ngh avatar d33pak-s1ngh commented on June 27, 2024

the real purpose of using websocket is that we can consume server side events and actions at client side without any page refresh. client can be android or ios app or even a web app itself.
so if an admin will generate any notification from web app an android device listening to websocket should receive a notifcation without any action performed.

thank you for any kind of help.

from codeigniter-ratchet-websocket.

kishor10d avatar kishor10d commented on June 27, 2024

@d33pak-s1ngh : I think you didn't read README.md. It is doing the same thing what are you thinking about. It is doing without page-refresh. It is just the matter of setting it up properly. I think you didn't started websocket server.

from codeigniter-ratchet-websocket.

d33pak-s1ngh avatar d33pak-s1ngh commented on June 27, 2024

how do i start a websocket server?
i tried to run command
php server.php which throws following error

from codeigniter-ratchet-websocket.

d33pak-s1ngh avatar d33pak-s1ngh commented on June 27, 2024

following is the setting in constant.php it contains my ip address and i change port from 2000 to 8181 just for testing but still getting error.
/** WEBSOCKETS BROADCAST TYPES **/

define("POST", "post");
define("BROADCAST_URL", "116.72.11.241");
define("BROADCAST_PORT", "8181");

Following is screenshot of error saying that address is already in use.

sock1

from codeigniter-ratchet-websocket.

kishor10d avatar kishor10d commented on June 27, 2024

@d33pak-s1ngh : Remember, this code will not work on shared hosting server (known issue). Also if you wanna test it on localhost then you must give the ip-address of your machine over LAN (i.e. 192.168.1.xxx like that).

from codeigniter-ratchet-websocket.

d33pak-s1ngh avatar d33pak-s1ngh commented on June 27, 2024

ok so i will host it on server and use that ip to test.

from codeigniter-ratchet-websocket.

d33pak-s1ngh avatar d33pak-s1ngh commented on June 27, 2024

will do it sure i want to understand socket

from codeigniter-ratchet-websocket.

d33pak-s1ngh avatar d33pak-s1ngh commented on June 27, 2024

hii @kishor10d i think everything working fine except that connection.js is not able to make connection with socket server check the following from firefox browser.
socket

all this is happening because php server.php command is not executing the script successfully it throws error of BROADCAST_URL error.

you are saying that i have to provide lan ip as value of BROADCAST_URL that is also fine.

but i have 2 machines connect with same lan ip and you are saying that it will not work with share hosting server so what should i do?
how i can set an ip?
please help me to understand.
thank you.

from codeigniter-ratchet-websocket.

kishor10d avatar kishor10d commented on June 27, 2024

@d33pak-s1ngh : You need to keep the websocket server running. That warning means your socket is not running. Also instead of ip_address you can give your domain name also. (e.g. example.com). If you have root access then you can make it run on your shared hosting too.

Websocket server cannot be keep running, so you have to ping it after some interval. You can schedule a cron job (dirty practice) or refer this http://stackoverflow.com/questions/19487664/how-do-i-keep-a-websocket-server-running-even-after-i-close-the-ssh-terminal

from codeigniter-ratchet-websocket.

d33pak-s1ngh avatar d33pak-s1ngh commented on June 27, 2024

i dont have a domain name i have an ip address of my server and i have a root access of that server
i have hosted your application on that and i am accessing it from server like
104.131.2.03/socket

from codeigniter-ratchet-websocket.

d33pak-s1ngh avatar d33pak-s1ngh commented on June 27, 2024

whenever i type command php server.php it doesnt give any result then i have to interrupt the service and again fire the command than it gives error that address is already in use.

from codeigniter-ratchet-websocket.

kishor10d avatar kishor10d commented on June 27, 2024

@d33pak-s1ngh : It doesn't give any result means it is working. Don't interupt it. and try from your browser.

from codeigniter-ratchet-websocket.

d33pak-s1ngh avatar d33pak-s1ngh commented on June 27, 2024

finally found the problem and now it is working fine. i open in two tabs and enter some value from one tab which is now appear's in both tab.

the problem was after typing command php server.php there was no result so i press ctl+z to stop it then again i try php server.php then it throws error that address is in use because in previous command it started websocket server but after typing it again mess the port.

from codeigniter-ratchet-websocket.

d33pak-s1ngh avatar d33pak-s1ngh commented on June 27, 2024

thanx kishor i got it but now the problem is i cant keep my cmd open all time . this thing should be running in background all the time. what should i do for it??

from codeigniter-ratchet-websocket.

d33pak-s1ngh avatar d33pak-s1ngh commented on June 27, 2024

also i checked your admin panel in codeigniter in codeinsect how i can add this socket feature in to that codeigniter panel?

from codeigniter-ratchet-websocket.

kishor10d avatar kishor10d commented on June 27, 2024

Here is the solution for your command line problem. Also you can free your ports by killing the process. Everything explain in the following url.
Please refere this url :
http://stackoverflow.com/questions/19487664/how-do-i-keep-a-websocket-server-running-even-after-i-close-the-ssh-terminal

And you ask about CodeInsect Admin Panel, actually it is ready admin panel and you can add your features into it. Its your choice that how you integrate your code into it. Just copy and paste the same things of third_party folder, and implement the controllers into controllers. You can do it easily.

from codeigniter-ratchet-websocket.

d33pak-s1ngh avatar d33pak-s1ngh commented on June 27, 2024

ook thank you for this awesome work i will try to merge admin panel with socket and inform u.

from codeigniter-ratchet-websocket.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.