Website - live editing text

Discussion in 'Plugins and Coding' started by _Oplex_, Nov 2, 2018.

  1. _Oplex_

    _Oplex_ Member

    Messages:
    689
    Likes Received:
    1,014
    Trophy Points:
    148
    _Oplex_
    Obsidian
    So lets say i have 2 people. And they both go on the same page. All they see is a empty textArea. If person1 would edit the text i want to also change the text on person2 screen. First i want to try simple ajax, but that is just not a good solution.
    Now im thinking about a server side event. Would that work? I googled about it and it looks good to me. But are there any other things i can try?
    It can be simple or complex.
     
  2. A Christmas Hangar

    A Christmas Hangar Member

    Messages:
    3,180
    Likes Received:
    2,826
    Trophy Points:
    358
    HangarGeek
    Obsidian
    Like a chat?
    Ajax is a nice, simple solution iirc

    How would you implement a server side solution for “live changes” without refreshing?

    Don’t take my advice as something 101% correct
     
  3. _Oplex_

    _Oplex_ Member

    Messages:
    689
    Likes Received:
    1,014
    Trophy Points:
    148
    _Oplex_
    Obsidian
    With a server side event. https://www.w3schools.com/html/tryit.asp?filename=tryhtml5_sse

    And its not a chat. Its more like a google doc. That multiple people can edit at the same time
     
  4. A Christmas Hangar

    A Christmas Hangar Member

    Messages:
    3,180
    Likes Received:
    2,826
    Trophy Points:
    358
    HangarGeek
    Obsidian
  5. Land

    Land Member

    Messages:
    1,404
    Likes Received:
    2,667
    Trophy Points:
    233
    WOOOOOOOOOOOOOOP
    SSE seems to be the best option, wouldnt recommend PHP for this however, Node seems like a much better fit

    Something janky with ajax could also work, although like you said, not the best option.

    There's also a library for SSE in PHP, don't know how well it works, https://github.com/licson0729/libSSE-php
     
    _Oplex_ and A Christmas Hangar like this.
  6. _Oplex_

    _Oplex_ Member

    Messages:
    689
    Likes Received:
    1,014
    Trophy Points:
    148
    _Oplex_
    Obsidian
    Yep, that would be great. but the server i want to host this on has also a mail client on it. I am not that experienced with setting up such thing with ports etc. I am now using socket.io and that is actually what i want. It works fast and easy.

    im just making it. and the server would be a problem on a later stage. thx @A Christmas Hangar and @zivdnaL
     
    Land likes this.