Websocket Chat Example

0 favourites
  • 11 posts
From the Asset Store
Chat with smart animals using the OpenAi Chat GPT 3 API
  • My new example for using Websockets.

    Here is the game :)

    In the process of writing a tutorial! Will post here when done.

    Can someone test this please? It worked when me and my friend uses it (we live about 10 miles apart) bu I noticed that the play count has gone up, but my server isnt showing any new connections. What should happen is:

    You choose a username

    You come to a list box with no text in it. As people send messages, the box will fill up

    You send messages by typing in the textbox at the bottom and hitting ENTER

    Can you please post here if it doesnt work for you?

  • BUMP. Edited OP.

  • Looks cool, this is something like I am looking for, a simple chat. Do you know how long before the tutorial or files will be released?

  • I'm trying to upload the tutorial, but for some reasin I keep getting a Server URI Error. I've asked about it, but no chanbe at the minute :/

  • Hello! I am new to construct 2 and would like to know how web socket works? Thank you

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi BasicUser :)

    Sorry, I took down the example because i couldnt keep my computer running all the time. To start using Websockets, you need a server application running on your computer, then you need to poimt your C2 app to it using the Websocket object.

    C2 does not include a way for coding a server but you can find many open source implemenrations on Google.

    The basics of using web sockets is using text messages to communicate with the server. You will need to write your own logic in the client and rhe server as to how your messafes are interpreted. you can find many examples of this on Google :) hope this helps!

  • marlon667 I'm still confused, I tested with websocket.org/echo.html to connect with your .capx example, it doesn't do anything.

    I'm still unaware how to use websocket, I have zero knowledge how to use websocket, but not at all, I know how to use php in server, but websocket is different...

    Would you explain step by step? then do you know some free hosting services include websocket?


  • Joannesalfa, I tried numerous times to post a tutorial to go with this example, but I kept getting a Server URI error. I think it has something to do with the Scirra Website, I'm not sure, but I took my example down because I had AS exams and I couldn't leave the server running on my computer.

    Here is the basics of WebSockets:

    WebSockets are upgraded HTTP requests that need a specialised server application to handle them. You can create one yourself, or use an existing Websocket server as a base. I originally used a Node.JS implementation, but I switched to C# for better SQL support.

    The test at websocket.org/echo.html is essentially the same as my .capx file in the sense that it is just a client application. You need to open a Websocket connection to a server application to enable communication.

    There are no hosting services that provide Websocket services per se. A Websocket server is a stand-alone application that you connect multiple clients to.

    If you wanted to work with my example .capx, here's a few things that will help:

    This is a server implementation in C# that I use. The base server allows you to listen for connection requests on a port that you choose, and then accept connections and incomming messages for each connection. What you want to do with those messages is something you have to write yourself.

    In my example .capx, I believe there is a global variable containing the location of the websocket server. If you are running the server on the same computer you use the client, change the server location to localhost. That way you can send messages to your server.

    If you need anymore help, reply here :) I'm gonna try my tutorial again, this seems like a problem for a few people.

  • marlon667

    I can't find .capx of your chat! Where is it?

  • sergyperov

    I took down my example, as I couldn't leave my computer on all the time to host the server. It will go back up soon, but I have to focus on starting my Computing project for my A2. I will put it back up soon, however, hopefully with a video tutorial :)

    On that note, I might as well add that I'm working on a bit Websocket project for my A2 Computing coursework, and when I start, it will be on Github :) I'll post my repo here when I get it up

  • so, i have a 24/7 server hosting from my computer, i cant send messages to my server, but not recieve them, can anyone help? Im doing Websocket server, not multiplayer

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)