Problem with reproduising Steve Hannah chat app base on websocket sample

84 views
Skip to first unread message

Housseini Moussa

unread,
Sep 23, 2016, 11:08:57 AM9/23/16
to CodenameOne Discussions
Hi
I have a problem when I am trying to reproduise the Steve Hannah chat app base on websocket protocol(https://github.com/shannah/cn1-websockets) .

This is the message I had on my console when I am executing the apps

java.lang.ClassNotFoundException: com.mhsoft.mhtalk.WebSocketNativeImplImpl
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClaJava Result: 1
BUILD SUCCESSFUL (total time: 46 seconds)

Please I need you help


Shai Almog

unread,
Sep 24, 2016, 1:58:32 AM9/24/16
to CodenameOne Discussions
Hi,
in which IDE?
Did you install websockets thru the extension manager tool?

Housseini Moussa

unread,
Sep 25, 2016, 3:17:50 AM9/25/16
to CodenameOne Discussions
Hi

i am using netbeans IDE
l copy and paste the cn1-websockets.cn1lib file from the latest release into my project’s lib directory. Then select "Refresh Libs".

But when I am trying to run it this is the message l have on my console

compile:
run:

java.lang.ClassNotFoundException: com.mhsoft.mhtalk.WebSocketNativeImplImpl
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.ClassLoader.findSystemClass(ClassLoader.java:1001)
    at com.codename1.impl.javase.ClassPathLoader.findClass(ClassPathLoader.java:100)
    at com.codename1.impl.javase.ClassPathLoader.loadClass(ClassPathLoader.java:50)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:259)
    at com.codename1.system.NativeLookup.create(NativeLookup.java:81)
    at com.mhsoft.mhtalk.WebSocket.<init>(WebSocket.java:105)
    at com.mhsoft.mhtalk.MHTalk$1.<init>(MHTalk.java:43)
    at com.mhsoft.mhtalk.MHTalk.init(MHTalk.java:43)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.codename1.impl.javase.Executor$1$1.run(Executor.java:81)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1151)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:968)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
java.lang.NullPointerException
    at com.mhsoft.mhtalk.WebSocket.<init>(WebSocket.java:106)
    at com.mhsoft.mhtalk.MHTalk$1.<init>(MHTalk.java:43)
    at com.mhsoft.mhtalk.MHTalk.init(MHTalk.java:43)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.codename1.impl.javase.Executor$1$1.run(Executor.java:81)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1151)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:968)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
Java Result: 1
BUILD SUCCESSFUL (total time: 16 seconds)



Housseini Moussa

unread,
Sep 25, 2016, 7:39:49 AM9/25/16
to CodenameOne Discussions
hi
i am using netbeans IDE;

I use the extension manager tool to download the websocket lib after finishing download I
select "Refresh Libs".

I provide here the code file of my application and the  error in my console when running the app

code 1

public class MHTalk {

    private Form current;
    private Resources theme;
    WebSocket sock;
    Container chatContainer;

    public static final String SERVER_URL="ws://localhost:8080/cn1-websocket-demo-server/chat";
   
    public void init(Object context) {
        theme = UIManager.initFirstTheme("/theme");

        // Enable Toolbar on all Forms by default
        Toolbar.setGlobalToolbar(true);

        // Pro only feature, uncomment if you have a pro subscription
        // Log.bindCrashProtection(true);
       
        sock = new WebSocket(SERVER_URL) {

            @Override
            protected void onOpen() {
                System.out.println("In onOpen");
            }

            @Override
            protected void onClose(int statusCode, String reason) {
               
            }

            @Override
            protected void onMessage(final String message) {
                System.out.println("Received message "+message);
                Display.getInstance().callSerially(new Runnable() {
                    public void run() {
                        if (chatContainer == null) {
                            return;
                        }
                        SpanLabel label = new SpanLabel();
                        label.setText(message);
                        chatContainer.addComponent(label);
                        chatContainer.animateHierarchy(100);
                    }
                   
                });
            }

            @Override
            protected void onError(Exception ex) {
                System.out.println("in onError");
            }

             @Override
             protected void onMessage(byte[] message) {
                
             }
           
        };
        System.out.println("Sending connect");
        sock.connect();
    }
   
    void showLogin() {
        Form f = new Form("MHTalk");
        f.addComponent(new Label("Name: "));
        final TextField nameField = new TextField();
        f.addComponent(nameField);
        f.addComponent(new Button(new Command("Login"){

            @Override
            public void actionPerformed(ActionEvent evt) {
                sock.send(nameField.getText());
                showChat(nameField.getText());
            }
              
        }));
        f.show();
    }
   
    void showChat(String username) {
        Form f= new Form("Welcome "+username+" Chat Form");
        f.setLayout(new BorderLayout());
        Container south = new Container();
        final TextField tf = new TextField();
        Button send = new Button(new Command("Send") {
            @Override
            public void actionPerformed(ActionEvent evt) {
                sock.send(tf.getText());
                tf.setText("");
            }
            
        });
       
        chatContainer = new Container();
        chatContainer.setScrollableY(true);
        chatContainer.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
       
        south.addComponent(tf);
        south.addComponent(send);
        f.addComponent(BorderLayout.SOUTH, south);
        f.addComponent(BorderLayout.CENTER, chatContainer);
        f.setFormBottomPaddingEditingMode(true);
        f.show();
       
    }
    public void start() {
        if(current != null){
            current.show();
            return;
        }
//        Form hi = new Form("Hi World");
//        hi.addComponent(new Label("Hi World"));
//        hi.show();
        showLogin();
    }

    public void stop() {
        current = Display.getInstance().getCurrent();
        if(current instanceof Dialog) {
            ((Dialog)current).dispose();
            current = Display.getInstance().getCurrent();
        }
    }
   
    public void destroy() {
    }

}
 
code 2

public abstract class WebSocket {
   
    private static int nextId = 1;
    WebSocketNativeImpl impl ;
   
    public static class WebSocketException extends IOException {
        private final int code;
        public WebSocketException(String message, int code) {
            super(message);
            this.code = code;
        }
        public int getCode(){
            return code;
        }
    }
   
    private static WeakHashMap<Integer,WebSocket> sockets = new WeakHashMap<Integer,WebSocket>();
   
    //Utility method for the iOS port to create a new byte array
    static byte[] newByteArray(int len) {
        return new byte[len];
    }
   
    static void messageReceived(int id, String message) {
        WebSocket socket = sockets.get(id);
        if (socket == null) {
            sockets.remove(id);
        } else {
            socket.onMessage(message);
        }
    }
   
    static void messageReceived(int id, byte[] message) {
        WebSocket socket = sockets.get(id);
        if (socket == null) {
            sockets.remove(id);
        } else {
            socket.onMessage(message);
        }
    }
   
    static void closeReceived(int id, int statusCode, String reason) {
        WebSocket socket = sockets.get(id);
        if (socket == null) {
            sockets.remove(id);
        } else {
            socket.onClose(statusCode, reason);
            sockets.remove(id);
        }
    }
   
    static void openReceived(int id) {
        WebSocket socket = sockets.get(id);
        if (socket == null) {
            sockets.remove(id);
        } else {
            socket.onOpen();
        }
    }
   
    static void errorReceived(int id, String message, int code) {
        WebSocket socket = sockets.get(id);
        if (socket == null) {
            sockets.remove(id);
        } else {
            WebSocketException ex = new WebSocketException(message,code);
            socket.onError(ex);
        }
    }
   
    public WebSocket(String url) {
        impl = (WebSocketNativeImpl)com.codename1.system.NativeLookup.create(WebSocketNativeImpl.class);
        impl.setId(nextId++);
        sockets.put(impl.getId(),this);
        impl.setUrl(url);
    }
   
    protected abstract void onOpen();
    protected abstract void onClose(int statusCode, String reason);
    protected abstract void onMessage(String message);
    protected abstract void onMessage(byte[] message);
    protected abstract void onError(Exception ex);
   
    public void send(String message) {
        impl.sendString(message);
    }
    public void send(byte[] message) {
        impl.sendBytes(message);
    }
   
    public void close() {
        impl.close();
    }
   
    public void connect() {
        impl.connect();
    }
}

Code 3

public interface WebSocketNativeImpl extends NativeInterface {
   
    public void setUrl(String url);
    public void setId(int id);
    public int getId();
    public void sendBytes(byte[] message);
    public void sendString(String message);
    public void close();
    public void connect();
   
}

Console error message when running the app


compile:
run:
java.lang.ClassNotFoundException: com.mhsoft.mhtalk.WebSocketNativeImplImpl
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.ClassLoader.findSystemClass(ClassLoader.java:1001)
    at com.codename1.impl.javase.ClassPathLoader.findClass(ClassPathLoader.java:100)
    at com.codename1.impl.javase.ClassPathLoader.loadClass(ClassPathLoader.java:50)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:259)
    at com.codename1.system.NativeLookup.create(NativeLookup.java:81)
    at com.mhsoft.mhtalk.WebSocket.<init>(WebSocket.java:87)
    at com.mhsoft.mhtalk.MHTalk$1.<init>(MHTalk.java:42)
    at com.mhsoft.mhtalk.MHTalk.init(MHTalk.java:42)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.codename1.impl.javase.Executor$1$1.run(Executor.java:81)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1151)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:968)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
java.lang.NullPointerException
    at com.mhsoft.mhtalk.WebSocket.<init>(WebSocket.java:88)
    at com.mhsoft.mhtalk.MHTalk$1.<init>(MHTalk.java:42)
    at com.mhsoft.mhtalk.MHTalk.init(MHTalk.java:42)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.codename1.impl.javase.Executor$1$1.run(Executor.java:81)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1151)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:968)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
Java Result: 1
BUILD SUCCESSFUL (total time: 20 seconds)

Please help

Shai Almog

unread,
Sep 26, 2016, 12:04:46 AM9/26/16
to CodenameOne Discussions

Hi,
did you create or open an old project?
Is your build.xml up to date?

To check the build.xml version go to Codename One Settings and click save. It will offer to update it if it's old.
Did you change the classpath of project in any way?
The run section of the classpath should look like this with the native/internal_tmp directory.



Housseini Moussa

unread,
Sep 26, 2016, 3:34:37 AM9/26/16
to CodenameOne Discussions


 HI
 
l create a new projet and my build.xml is up to date. l did not change the classpath of my project.
The run section of the classpath look like this; Here is the picture of it















When I run againt the app I have same error message; which is provide in the following; I don't what to do to solve this probleme


compile:
run:
java.lang.ClassNotFoundException: com.mhsoft.mhtalk.WebSocketNativeImplImpl
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.ClassLoader.findSystemClass(ClassLoader.java:1001)
    at com.codename1.impl.javase.ClassPathLoader.findClass(ClassPathLoader.java:100)
    at com.codename1.impl.javase.ClassPathLoader.loadClass(ClassPathLoader.java:50)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:259)
    at com.codename1.system.NativeLookup.create(NativeLookup.java:81)
    at com.mhsoft.mhtalk.WebSocket.<init>(WebSocket.java:87)
    at com.mhsoft.mhtalk.MHTalk$1.<init>(MHTalk.java:41)
    at com.mhsoft.mhtalk.MHTalk.init(MHTalk.java:41)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.codename1.impl.javase.Executor$1$1.run(Executor.java:81)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1151)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:968)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
java.lang.NullPointerException
    at com.mhsoft.mhtalk.WebSocket.<init>(WebSocket.java:88)
    at com.mhsoft.mhtalk.MHTalk$1.<init>(MHTalk.java:41)
    at com.mhsoft.mhtalk.MHTalk.init(MHTalk.java:41)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.codename1.impl.javase.Executor$1$1.run(Executor.java:81)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1151)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:968)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
Java Result: 1
BUILD SUCCESSFUL (total time: 10 seconds)


Shai Almog

unread,
Sep 27, 2016, 1:22:44 AM9/27/16
to CodenameOne Discussions
Hi,
it looks like we still have a problem in the new project wizard.
Go to the run classpath and add the following directory
"lib/impl/native/javase"

Housseini Moussa

unread,
Sep 27, 2016, 3:44:16 AM9/27/16
to CodenameOne Discussions
Hi

l did what you suggested to me ( <<Go to the run classpath and add the following directory "lib/impl/native/javase">> ). But l still have thesame problem.

l don't know what to do.


Here are the message I still have on the console


java.lang.ClassNotFoundException: com.mhsoft.mhtalk.WebSocketNativeImplImpl
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.ClassLoader.findSystemClass(ClassLoader.java:1001)
    at com.codename1.impl.javase.ClassPathLoader.findClass(ClassPathLoader.java:100)
    at com.codename1.impl.javase.ClassPathLoader.loadClass(ClassPathLoader.java:50)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:259)
    at com.codename1.system.NativeLookup.create(NativeLookup.java:81)
    at com.mhsoft.mhtalk.WebSocket.<init>(WebSocket.java:87)
    at com.mhsoft.mhtalk.MHTalk$3.<init>(MHTalk.java:112)
    at com.mhsoft.mhtalk.MHTalk.websocketconnection(MHTalk.java:112)

    at com.mhsoft.mhtalk.MHTalk.init(MHTalk.java:41)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.codename1.impl.javase.Executor$1$1.run(Executor.java:81)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1151)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:968)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
java.lang.NullPointerException
    at com.mhsoft.mhtalk.WebSocket.<init>(WebSocket.java:88)
    at com.mhsoft.mhtalk.MHTalk$3.<init>(MHTalk.java:112)
    at com.mhsoft.mhtalk.MHTalk.websocketconnection(MHTalk.java:112)

    at com.mhsoft.mhtalk.MHTalk.init(MHTalk.java:41)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.codename1.impl.javase.Executor$1$1.run(Executor.java:81)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1151)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:968)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
Java Result: 1
BUILD SUCCESSFUL (total time: 9 seconds)


Shai Almog

unread,
Sep 28, 2016, 12:07:46 AM9/28/16
to CodenameOne Discussions
What's MHTalk Websocket?
Is that your class?
What do you do in line 83?
Did you change something about the project?
Is it an old project or one that you created using the new project wizard?
Did you pick one of the Codename One demos?

Housseini Moussa

unread,
Sep 28, 2016, 1:20:41 AM9/28/16
to CodenameOne Discussions
Hi,

MHTalk is my class. It is where I design all the application interface and fonctionnality.
I do not change anything about the projet
The MHTalk projet is created using the new project wizard.
No l did not pick the Codename One demos.

What l did is l reproduise the Steve Hannah chat app base on websocket protocol(https://github.com/shannah/cn1-websockets) in the MHTalk projet.


Housseini Moussa

unread,
Sep 28, 2016, 1:26:05 AM9/28/16
to CodenameOne Discussions

HERE IS THE TREE OF THE PROJET

Chen Fishbein

unread,
Sep 28, 2016, 2:10:29 AM9/28/16
to CodenameOne Discussions
The impl class is com.codename1.io.websocket,WebSocketNativeImplImpl and not com.mhsoft.mhtalk.WebSocketNativeImplImpl
Try to move the WebSocket and the WebSocketNativeImpl to the com.codename1.io.websocket package

Housseini Moussa

unread,
Sep 28, 2016, 4:31:44 AM9/28/16
to CodenameOne Discussions

Hi,

l have got a solution to solve my probleme.

This is what l did I do not no if it is the good way but it can help somebody and l need your appreciation on that

1-I create a new codenameone projet using the netbeans IDE called MHTalk
2-I download the websocket lib by using the codenameone extension manager tool
3-I select "Refresh Libs" after finishing download the lib
4-I select the project on netbeans I "right click the mouse" and select "Build"
5-After the build is done I execute the project and it work verry well
6-This is the code of my MHTalk project
package com.mhsoft.mhtalk;


import com.codename1.components.SpanLabel;
import com.codename1.ui.Display;
import com.codename1.ui.Form;
import com.codename1.ui.Dialog;
import com.codename1.ui.Label;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.util.Resources;
import com.codename1.io.Log;
import com.codename1.io.websocket.WebSocket;
import com.codename1.ui.Button;
import com.codename1.ui.Command;
import com.codename1.ui.Container;
import com.codename1.ui.TextField;
import com.codename1.ui.Toolbar;
import com.codename1.ui.events.ActionEvent;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.layouts.BoxLayout;
import java.io.IOException;

/**
 * This file was generated by <a href="https://www.codenameone.com/">Codename One</a> for the purpose
 * of building native mobile applications using Java.
 */

public class MHTalk {

    private Form current;
    private Resources theme;
    WebSocket sock;
    Container chatContainer;
    public static final String SERVER_URL="ws://localhost:8080/cn1-websocket-demo-server/chat";

    public void init(Object context) {
        theme = UIManager.initFirstTheme("/theme");

        // Enable Toolbar on all Forms by default
        Toolbar.setGlobalToolbar(true);

        // Pro only feature, uncomment if you have a pro subscription
        // Log.bindCrashProtection(true);
        websocketconnection();
    public void websocketconnection(){
Here are some screen shots of the test


Reply all
Reply to author
Forward
0 new messages